What are the nested parameters in http?

In Laravel Docs, when checking, they talk about "nested parameters":

If your HTTP request contains "nested" parameters, you can specify them in your validation rules using the "dot" syntax:

$this->validate($request, [ 'title' => 'required|unique:posts|max:255', 'author.name' => 'required', 'author.description' => 'required', ]); 

What does HTML look like for this nesting? I googled around and found nothing but things related to the nesting form. Also, "dot" syntax , is this specific to Laravel?

+7
html php forms laravel
source share
1 answer

Point notation is designed for easy access to array elements and makes their selectors more โ€œwhiteโ€.

Confirming author.name will be equivalent to checking the input value <input type="text" name="author[name]" /> .

This makes using multimodel forms or grouping related data much nicer =). Then you can get all the data for this thing by doing something like $request->request('author'); , and this will give you a set / array of all the values โ€‹โ€‹represented with author[*] . Laravel also uses it with its configuration accessories - therefore config.setting.parameter is the equivalent of config[setting][parameter]

Basically simplifies working with array data.

For some examples, see https://github.com/glopezdetorre/dot-notation-access !

+2
source

All Articles