dimanche 8 décembre 2019

Laravel Eloquent relationship order by not working

I store Event and Event Schedules are tow different Tables. I Display Event by Event Schedule Date Ascending. I use the following Query Its not Display Correctly.

 $eventslist=Events::with(['eventschedule' => function($query) {  $query->orderBy('eventdate', 'ASC'); }])->paginate($this->recordsperpage);

In Event Model :

public function eventschedule(){

        return $this->hasMany('App\Eventshcedule','events_id','id')->orderBy('eventdate', 'ASC');

    }

enter image description here

I need to display events by Date wise asending.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire