mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Refactor Requestable@cancelRequest() firm to admit a user_id so we can cancel a request of whatever user we want
This commit is contained in:
parent
b647a8fcd2
commit
eb4d764601
|
@ -38,8 +38,12 @@ trait Requestable
|
|||
$this->requests()->where('user_id', Auth::id())->delete();
|
||||
}
|
||||
|
||||
public function cancelRequest()
|
||||
public function cancelRequest($user_id = null)
|
||||
{
|
||||
$this->requests()->where('user_id', Auth::id())->update(['canceled_at' => \Carbon\Carbon::now()]);
|
||||
if (!$user_id){
|
||||
$user_id = Auth::id();
|
||||
}
|
||||
|
||||
$this->requests()->where('user_id', $user_id)->update(['canceled_at' => \Carbon\Carbon::now()]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue