ldc-portsalaries/app/Http/Requests/StoreCrudModel.php
2021-06-07 18:28:25 +02:00

36 lines
796 B
PHP

<?php
namespace App\Http\Requests;
use App\Enums\CrudAction;
class StoreCrudModel extends CrudRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$model = $this->getCurrentModel();
/** @var \App\Models\User|null $user */
// $user = auth()->user();
// return auth()->check() and $user->can('update', $model);
$authorized = true;
if ($authorized) {
$this->rules = $this->getRulesForAction(CrudAction::create());
}
return $authorized;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return $this->rules;
}
}