Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel queues job payload data

Queue::before(function (JobProcessing $event) {
    $jsonpayload = $event->job->payload();

    if ($jsonpayload['data']['commandName'] === 'AppJobsSendAlert') {
        $data = unserialize($jsonpayload['data']['command']);
        $user = DB::table('users')->where('id','=',$data->test->user_id)->first();
        $pay = DB::table('donates')->where('user_id','=',$user->id)->where('status','=','0')->first();
        if(!is_null($pay)) {
            $event->job->release(Carbon::now()->addSeconds(60));
        }
    }
});
Source by laracasts.com #
 
PREVIOUS NEXT
Tagged: #laravel #queues #job #payload #data
ADD COMMENT
Topic
Name
8+7 =