skip to Main Content

laravel search in other table on json column by relation

i try make code for search and this is my code: $services = Service::query()->with('plans')->latest(); if ($request->service_name) { $services = $services->whereRaw("CONVERT(JSON_EXTRACT(name, '$.ar') using 'utf8') LIKE '%$request->service_name%' ") ->orWhereRaw("CONVERT(JSON_EXTRACT(name, '$.en') using 'utf8') LIKE '%$request->service_name%' ") ->orWhereRaw("CONVERT(JSON_EXTRACT(name, '$.he') using 'utf8') LIKE '%$request->service_name%' ");…

VIEW QUESTION

Laravel – The POST method is not supported for route admin/bill. Supported methods: GET, HEAD

In Laravel i use ajax for adding and fetching data from MySQL Database through blade template, i have add form summation on onsubmit event. Please Help me. My codes are. Route.php Route::get('admin/bill',[BillingController::class, 'bill'])->name('billing'); Route::post('admin/billing/add',[BillingController::class, 'billadd'])->name('admin.bill.add'); Controller.php public function billadd(Request $request){…

VIEW QUESTION

Laravel – How to add attribute to Eloquent collection?

In Message.php model: public function getAudioUrlAttribute() { return Storage::disk('public')->url('audio/' . $this->audio); } in MessageController.php $messages = Message::select('id', 'role', 'content', 'audio')->get(); $messages = $messages->map(function($message) { return $message->only('id', 'role', 'content', 'audio_url'); }); return ['messages' => $messages]; how to add audio_url to the…

VIEW QUESTION
Back To Top
Search