samedi 28 novembre 2015

Setting up Queue in Lumen Framework

I'm trying to set up queue in Lumen using the guide from lumen page: http://ift.tt/1XxL9rt

<?php

namespace App\Jobs;

use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;

class BlastEmail extends Job implements SelfHandling, ShouldQueue
{
    public function sendEmail()
    {
        [...CODE TO SEND EMAIL...]
    }

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

and in My Controller

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Jobs\BlastEmail;
use App\Models\Blast;
use App\Models\Subscriber;
use Illuminate\Http\Request;
use Validator;

class BlastsController extends BaseController
{
    public function queue(Request $request)
    {
        $job = (new BlastEmail($email,$request->input('content'),$request->input('title')));
        $this->dispatch($job);
    }
}

And I got "Undefined method App\Http\Controllers\BlastsController::dispatch"

Do I miss something?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire