$document = new DiDom\Document($url->name, true);
$data = ['name' => "https://test.ru"];
$response = $this->post(route('urls.store'), ['url' => $data]);
public function store(Request $request)
{
$formData = $request->input('url');
$validator = Validator::make($formData, [
'name' => 'required|unique:urls'
]);
if ($validator->fails()) {
flash('Некорректные данные')->error();
return redirect()->route('main');
}
[2021-02-10 18:22:21] testing.ERROR: Argument 1 passed to Illuminate\Validation\Factory::make() must be of the type array, null given, called in E:\all_web\hexlet_all\php_projects\php-project-lvl3\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 261 {"exception":"[object] (TypeError(code: 0): Argument 1 passed to Illuminate\\Validation\\Factory::make() must be of the type array, null given, called in E:\\all_web\\hexlet_all\\php_projects\\php-project-lvl3\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php on line 261 at E:\\all_web\\hexlet_all\\php_projects\\php-project-lvl3\\vendor\\laravel\\framework\\src\\Illuminate\\Validation\\Factory.php:98)
[stacktrace]
#0 E:\\all_web\\hexlet_all\\php_projects\\php-project-lvl3\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(261): Illuminate\\Validation\\Factory->make(NULL, Array)
#1 E:\\all_web\\hexlet_all\\php_projects\\php-project-lvl3\\app\\Http\\Controllers\\UrlController.php(33): Illuminate\\Support\\Facades\\Facade::__callStatic('make', Array)
#2 E:\\all_web\\hexlet_all\\php_projects\\php-project-lvl3\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): App\\Http\\Controllers\\UrlController->store(Object(Illuminate\\Http\\Request))
#3 E:\\all_web\\hexlet_all\\php_projects\\php-project-lvl3\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('store', Array)
#4 E:\\all_web\\hexlet_all\\php_projects\\php-project-lvl3\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(254): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\UrlController), 'store')
#5 E:\\all_web\\hexlet_all\\php_projects\\php-project-lvl3\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(197): Illuminate\\Routing\\Route->runController()
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
'access' => [
'class' => \yii\filters\AccessControl::className(),
'only' => ['create', 'update', 'delete', 'index'],
'rules' => [
[
'allow' => false,
'roles' => ['user', 'agent']
],
[
'allow' => true,
'roles' => ['administrator'],
]
],
],
];
}