diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 049be5dc9a2a..21a4779b46f9 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -3,7 +3,6 @@ namespace App\Http\Controllers\Api; use App\Events\CheckoutableCheckedIn; -use App\Http\Requests\StoreAssetRequest; use Illuminate\Support\Facades\Gate; use App\Helpers\Helper; use App\Http\Controllers\Controller; @@ -536,7 +535,7 @@ public function selectlist(Request $request) */ public function store(ImageUploadRequest $request) { - return Gate::allows('create', new Asset); + $this->authorize('create', Asset::class); $asset = new Asset(); $asset->model()->associate(AssetModel::find((int) $request->get('model_id'))); @@ -547,8 +546,7 @@ public function store(ImageUploadRequest $request) $asset->model_id = $request->get('model_id'); $asset->order_number = $request->get('order_number'); $asset->notes = $request->get('notes'); - $asset->asset_tag = $request->get('asset_tag', Asset::autoincrement_asset()); //yup, problem :/ - // NO IT IS NOT!!! This is never firing; we SHOW the asset_tag you're going to get, so it *will* be filled in! + $asset->asset_tag = $request->get('asset_tag', Asset::autoincrement_asset()); $asset->user_id = Auth::id(); $asset->archived = '0'; $asset->physical = '1';