lundi 11 juin 2018

Laravel queue to store data

I wanna try to store data into database via database queue Laravel.

But I always get this error "Undefined offset: 0"

this is my controller :

    public function store(Request $request)
   {
    $order = new Order;
    $order->code = $request->code;
    $order->created_at = $request->created_at;

    $this->dispatch(new SalesOrder($order));
   }

and this is my SalesOrder Jobs :

    protected $order;
    public function __construct(Order $order)
    {
      $this->order= $order;
    }


    public function handle()
    {
      $this->order->save();
    }

is there something wrong in my code? Please somebody help me fix this issue. Than's anyway.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire