Level 6
Ok I found the solution Ive created a dedicated criteria.
<?php
namespace App\Repositories\Criteria\Worksheets;
use App\Repositories\Criteria\Criteria;
use App\Repositories\Contracts\CriteriaInterface;
use App\Repositories\Contracts\RepositoryInterface;
use App\Repositories\Contracts\RepositoryInterface as Repository;
class Scheduled extends Criteria {
/**
* @param $model
* @param RepositoryInterface $repository
* @return mixed
*/
public function apply($model, Repository $repository)
{
$query = $model->whereUserId(auth()->user()->id)
->where('status', '=', 'scheduled')
->select('name as title', 'scheduled_date as start');
return $query;
}
}