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:
2018-09-30 21:32:33 -03:00
parent 4ec2b24885
commit 528d3b4caf
5 changed files with 99 additions and 14 deletions

View File

@@ -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();
}
}