mirror of
https://github.com/brunofontes/shareit.git
synced 2025-11-15 07:50:54 -03:00
Refactoring: TakeController returned item Mail moved to a listener
The TakeController was manually sending the email message as well as dealing with item return, so I moved the email message to it's own listener, I created an event for it and moved the return part to the item model.
This commit is contained in:
12
app/Item.php
12
app/Item.php
@@ -38,4 +38,16 @@ class Item extends Model
|
||||
{
|
||||
return (new static)->where('user_id', \Auth::id());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a specified item
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function returnItem()
|
||||
{
|
||||
$this->used_by = null;
|
||||
$this->waiting_user_id = null;
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user