Can someone explain how to do this with laravel eloquent? I can't seem to find a solution online (note that all times are in unix timestamp):
$this->model
->sortBy('start_datetime') // is unix timestamp
->where('start_datetime', '>', now()->startOfWeek()->timestamp)
->where('end_datetime', '<', now()->endOfWeek()->timestamp)
->get();
This generates the following error:
Call to undefined method App\Models\Model::sortBy()
I want to retrieve the datetimes in my database from the current week and then sort it by what day comes first. Because I'm using numbers (unix timestamp) in my db this shouldn't be so hard I guess.
P.S. I don't want to use Facades or static methods for this issue. So no answers with Model::