Including authenticaed user on models: Items, Product and User

This commit is contained in:
2018-09-19 14:58:10 -03:00
parent 839d2d5773
commit 092281a228
8 changed files with 44 additions and 13 deletions

View File

@@ -28,4 +28,14 @@ class Item extends Model
//Delete item
$item->delete();
}
/**
* Return the items from logged in user
*
* @return \App\Item
*/
public static function fromAuthUser()
{
return (new static)->where('user_id', \Auth::id());
}
}