mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-24 04:03:34 -08:00
Add declinedCheckout method to Accessory model
This commit is contained in:
parent
291fa1cd29
commit
4796598bb6
|
@ -32,6 +32,16 @@ class Accessory extends SnipeModel
|
|||
|
||||
use Searchable;
|
||||
use Acceptable;
|
||||
|
||||
public function declinedCheckout(User $declinedBy, $signature)
|
||||
{
|
||||
if (is_null($accessory_user = \DB::table('accessories_users')->where('assigned_to', $declinedBy->id)->where('accessory_id', $this->id)->latest('created_at'))) {
|
||||
// Redirect to the accessory management page with error
|
||||
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.does_not_exist'));
|
||||
}
|
||||
|
||||
$accessory_user->limit(1)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* The attributes that should be included when searching the model.
|
||||
|
|
Loading…
Reference in a new issue