'App\Jobs\ItestJob::__construct(): Argument #1 ($destination) must be of type App\Destination, string given

In my API, I'm trying to send these three parameter to this job ... but i got the following error

App\Jobs\ItestJob::__construct(): Argument #1 ($destination) must be of type App\Destination, string given, called in closure://function (\Illuminate\Http\Request $request) { $request->validate([
'destination_id' => 'required|exists:ivoipe.tbl_destinations,des_id', 'from' => 'required|numeric|min:0', 'to' => 'required|numeric|min:0', ]); $destination_id = Destination::where('des_id',$request->destination_id); $from = $request->from; $to = $request->to; \dispatch(new \App\Jobs\ItestJob($destination_id , $from, $to)); return \response()->json([ 'status' => true ]);} on line 13

Route::post('LoadUsers', function (Request $request) {
    $request->validate([
        'destination_id' => 'required|exists:mysql.table_destinations,des_id',
        'from' => 'required|numeric|min:0',
        'to' => 'required|numeric|min:0',
    ]);

    $destination_id = Destination::where('des_id',$request->destination_id);
    $from = $request->from;
    $to = $request->to;
    dispatch(new ItestJob($destination_id , $from, $to));
    return response()->json([
        'status' => true
    ]);
});

that my itestjob

private $destination;
private $from;
private $to;

 public function __construct(Destination $destination, float $from, float $to)
    {
        $this->queue = 'itest';

        $this->destination = $destination;
        $this->from = $from;
        $this->to = $to;

    }

       public function handle()
      {
        (new ItestClass())->itestQuery($this->destination, $this->from, $this->to);
     }



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source