mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
this is pretty much done
This commit is contained in:
parent
b0d7eb2168
commit
fdb6970f36
|
@ -12,6 +12,7 @@ use App\Models\User;
|
|||
use App\Notifications\RequestAssetCancelation;
|
||||
use App\Notifications\RequestAssetNotification;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Log;
|
||||
|
||||
class CreateCheckoutRequest
|
||||
{
|
||||
|
@ -47,16 +48,9 @@ class CreateCheckoutRequest
|
|||
try {
|
||||
$settings->notify(new RequestAssetNotification($data));
|
||||
} catch (\Exception $e) {
|
||||
\Log::warning($e);
|
||||
Log::warning($e);
|
||||
}
|
||||
|
||||
return true; // or $asset, or whatever
|
||||
return true;
|
||||
}
|
||||
|
||||
public function doSomethingElse()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -30,7 +30,12 @@ class CheckoutRequest extends Controller
|
|||
|
||||
public function destroy(Asset $asset): JsonResponse
|
||||
{
|
||||
try {
|
||||
CancelCheckoutRequest::run($asset, auth()->user());
|
||||
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/hardware/message.requests.canceled')));
|
||||
} catch (\Exception $e) {
|
||||
report($e);
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,8 +164,13 @@ class ViewAssetsController extends Controller
|
|||
|
||||
public function destroy(Asset $asset): RedirectResponse
|
||||
{
|
||||
try {
|
||||
CancelCheckoutRequest::run($asset, auth()->user());
|
||||
return redirect()->route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.canceled'));
|
||||
} catch (\Exception $e) {
|
||||
report($e);
|
||||
return redirect()->back()->with('error', 'something bad happened');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue