skip to Main Content

Issues with Laravel groupBy

I am using Laravel 10. This is crm_details table: I need to count each status,. Also I need to consider parent_token with the same value as a single row. That means 2 rows have same `parent_token' then It will consider…

VIEW QUESTION

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 – 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

Laravel join in HasMany relationship

I have three models: EmailTemplate EmailSend Attendee An EmailSend references both an Attendee and an EmailTemplate: class EmailSend extends MyBaseModel { ... public function attendee() { return $this->belongsTo(AppModalsAttendee::class); } public function template() { return $this->belongsTo(AppModalsEmailTemplate::class); } ... } and associated…

VIEW QUESTION
Back To Top
Search