app/Containers/Survey/Data/Criterias/SurveysByUserCriteria.php
/**
     * @param $model
     * @param PrettusRepositoryInterface $repository
     * @return Collection
     */
@param $model
@param PrettusRepositoryInterface $repository
@return Collection
@param $model @param PrettusRepositoryInterface $repository @return Collection
public function apply($model, PrettusRepositoryInterface $repository)
    {
        $farmer = $this->user->farmer;
        if ($farmer) {
            $plots = $farmer->plots;
            $plot_ids = $plots->pluck('id');
            return $model->whereIn('plot_id', $plot_ids);
        }
        else return new Collection;
    }
public function apply ( $ model , PrettusRepositoryInterface $ repository ) { $ farmer = $ this -> user -> farmer ; if ( $ farmer ) { $ plots = $ farmer -> plots ; $ plot_ids = $ plots -> pluck ( 'id' ) ; return $ model -> whereIn ( 'plot_id' , $ plot_ids ) ; } else return new Collection ; }
@param $model
 @param PrettusRepositoryInterface $repository
 @return Collection
@param $model @param PrettusRepositoryInterface $repository @return Collection