Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel requested assets without checkin/out [ch-17606] #13219

Merged
merged 8 commits into from
Jun 29, 2023
Prev Previous commit
Next Next commit
Refactor Requestable@cancelRequest() firm to admit a user_id so we ca…
…n cancel a request of whatever user we want
  • Loading branch information
inietov committed Jun 27, 2023
commit eb4d7646015fe00ed9a499299e3aaa3945ae20cb
8 changes: 6 additions & 2 deletions app/Models/Requestable.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ public function deleteRequest()
$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()]);
}
}