skip to Main Content

Laravel Ordering on Piviot table

public function get_user_documents() { $userId = Auth::id(); $user_documents = UserDocument::where('user_id', $userId) ->orWhereHas('share_documents', function ($query) use ($userId) { $query->where('users.id', $userId); }) ->with(['share_documents' => function ($query) use ($userId) { $query->where('users.id', $userId); }]) ->latest() ->get(); // $user_documents = $user_documents->map(function ($document) use ($userId) {…

VIEW QUESTION

Mysql – How to update a part of a json value

I have the following data and MySQL table : CREATE TABLE my_tbl( id INT, dataset_query longtext ); INSERT INTO my_tbl(id, dataset_query) VALUES (1, '{"database":1,"native":{"query":"SELECT * FROM view_1.device","template-tags":{}},"type":"native"}'); INSERT INTO my_tbl(id, dataset_query) VALUES (2, '{"database":1,"native":{"query":"SELECT id, name FROM view_1.request","template-tags":{}},"type":"native"}'); INSERT INTO…

VIEW QUESTION
Back To Top
Search