<?php
namespace App\Scopes;

trait UserScope
{
    /**
     * @param  \Illuminate\Database\Eloquent\Builder  $query
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public function scopeFilterUser($query)
    {
        $user = \user();
        if($user){
            $query->where('user_id', $user->id);
        }
    }
}
