mirror of
https://github.com/brunofontes/shareit.git
synced 2025-11-15 07:50:54 -03:00
Including authenticaed user on models: Items, Product and User
This commit is contained in:
10
app/Item.php
10
app/Item.php
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user