laravel request index can't list array Categorized

91
December 16, 2018, at 12:50 PM

Note: my question is not duplicate

I have form in out of site and use web api laravel 5.7, now is send these parameters as post:

estate: "545345"
id_number: "43534545"
serial_number: "435435345"
type[code_id]: "45345345435"
type[company]: ""
type[country]: ""
type[maintenance_period]: ""
type[model]: "5435345435"
type[name]: "5345345345"
waranty[company_id]: "0"
waranty[duration]: ""
waranty[end]: ""
waranty[start]: ""

part of form:

<input type="text" name="estate" required="">
<input type="text" name="id_number" required="">
<input type="text" name="type[code_id]">
<input type="text" name="type[company]">

Now I want to get type and waranty array: same as for example:

$type = ['name' => 'test','company' => '...', 'model' => '...' ]

I try these codes:

$type = $request->input('type.*'); // NULL
and
$type = $request->input('type'); // NULL
and 
$type = Input::get('type'); // NULL
and
$in = $request->all();
$type = $in['type']; // NULL
AND
$request->get('type'); // NULL
AND
$request->post('type') // NULL

Doesn't work :( , only I can get single variable, by this method: (but I need array)

$in = $request->all();
$in['type[code_id]'] ;

And I test type[][code_id],type[][name],... in form but not work :(

My axios method:

serial = function (id) {
    var srl = $(id).serializeArray();
    var post = {};
    for (const k in srl) {
        let item = srl[k];
        post[item.name] = item.value;
    }
    return post;
}
axios.post(url, serial("#frm")).then(function (res) {// succs axios ;
     console.log(res);
}).catch(err => {// error axios ;
    console.log(err);
}); // end axios ;

What is the Laravel native solution ? for this problem ?

note: I can create an function for solve this problem but I need laravel native solution.

Rent Charter Buses Company
READ ALSO
Query Working Fine MS SQL but Giving Error in PHP

Query Working Fine MS SQL but Giving Error in PHP

i am executing above QUERY in php it is giving error

149
PHP MySQL &ldquo;id&rdquo; Conflict and Uncaught PDOException

PHP MySQL “id” Conflict and Uncaught PDOException

Firstly, I'm experiencing ID conflictIn the database, I have a table called "admin" with row called "id"

136
Check the referrals, add the referrals to the balance and remove the referrals in php?

Check the referrals, add the referrals to the balance and remove the referrals in php?

I am trying to make this workThe script has to check the users from the users table one by one

103