morphTo(); } /** * @param EloquentBuilder $query * @param Carbon $start * @param Carbon $end * * @return mixed */ public function scopeDateIs(EloquentBuilder $query, Carbon $start, Carbon $end) { return $query->where('startdate', $start->format('Y-m-d 00:00:00'))->where('enddate', $end->format('Y-m-d 00:00:00')); } /** * User * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function user() { return $this->belongsTo('User'); } }