从多个模型的表单获取数据的问题 - Laravel

Could someone help me?

I am trying get data from form and divide to few models. I have problem with get array from form and add that data to database per model.

Code:

    <div class="form-check form-check-success">
      <label class="form-check-label">
         {!! Form::checkbox('certification_id[]', '1', false, ['class' => 'form-check-input']) !!}
          Data
       </label>
      </div>
    <div class="form-check form-check-success">
        <label class="form-check-label">
           {!! Form::checkbox('certification_id[]', '2', false, ['class' => 'form-check-input']) !!}
           Data
       </label>
  </div>

Controller code:

public function store(CreateWaybillRequest $request) {
  $waybill = new Waybill($request->all());

  $certifications = new WaybillCertification($request->$_POST['certification_id']);

//$id = Auth::user()->waybills()->save($waybill)->id;

  return print_r($certifications);

Request class:

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CreateWaybillRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'weight' => 'required',
            'fromDate' => 'required|date',
            'damage' => 'required',
            'fuelUsed' => 'required',
            'toDate' => 'required|date',
            'length' => 'required'

        ];
    }
}

This is wrong-

$certifications = new WaybillCertification($request->$_POST['certification_id']);

You don't access the request data like that.

Do this instead-

$request->certification_id

It will give you the array of your certification_id request.

I also want you to read the documentation and learn the basics first-

https://laravel.com/docs/5.7/requests