php – Laravel 5.8 : __construct() must be of the type integer, array given-ThrowExceptions

Exception or error:

hi i have a problem with form in laravel 5.8. When i send form i have this error

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_RECOVERABLE_ERROR)
Argument 2 passed to Symfony\Component\HttpFoundation\RedirectResponse::__construct() must be of the type integer, array given, called in C:\xampp\htdocs\transport\vendor\laravel\framework\src\Illuminate\Routing\Redirector.php on line 203

My controller:

public function zawies(Request $request, $id)
    $zawies = \App\Przedsiebiorca::findOrFail($request->id);

    $input = Input::all();
    $id = Input::get('idz');

    $zawies_lic = DB::table('dok_przed')->where('nr_dok', $request->nr_dok)->get();

    foreach($zawies_lic as $li){

    $powod = Input::get('powod');
    $dat_zaw = Input::get('dat_zaw');
    $dat_zaw_do = Input::get('dat_zaw_do');
    $dat_zaw_new = Carbon::createFromDate($dat_zaw)->addYear()->format('Y-m-d');
    $lic = \App\DokumentyPrzed::findOrFail($li->id);

    $lic->update(['status'=>'2','dat_zaw'=> $dat_zaw_new,'dat_zaw_do'=> $dat_zaw_do,'powod'=>$powod]);
    Alert::warning('Zawieszono licencję/zezwolenie przedsiębiorcy', '');
    return redirect('/przedsiebiorca', compact('zawies_lic'))->with('lic');

Here is my app:

When you click yellows icon show you form with dates fields. After click button ‘Zawieś’ here shows an error. But as I refresh the page, the form will execute the command correctly and correctly add data to the database despite the error shown above. What I’m doing wrong is showing this error.

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *