/** * Quick way to find and return a model by user_id field * @param [[Type]] $query [[Description]] * @param int $id the user_id * @return [[Type]] [[Description]] */ function scopeByUser($query, $id) { return $query->where('user_id', '=', $id)->first(); }