I followed this official guide in order to implement Amazon SQS mailing system into my Laravel 5 project
I've done executing both essential commands from the doc:
php artisan queue:table
php artisan make:command SendEmail --queued
The second line has created the file app/Commands/SendEmail.php for me as expected, which contains:
<?php namespace App\Commands;
use App\Commands\Command;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldBeQueued;
class SendEmail extends Command implements SelfHandling, ShouldBeQueued {
use InteractsWithQueue, SerializesModels;
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the command.
*
* @return void
*/
public function handle()
{
//
}
}
Now, I try to run simple Laravel queue command:
Queue::push(new SendEmail($message));
Then, I got this error message:
FatalErrorException in CandidateController.php line 47:
Class 'SendEmail' not found
I really have no clue. I tried including "App/Commands" into my "classmap" of composer.json but still no luck
This is my Controller method that triggers error:
public function get_testemail()
{
Queue::push(new SendEmail( array( // <<< This is Line 47
'can_id' => 105,
'template'=>'candidate_register'
)));
var_dump($result);
die();
}
Really, really appreciate your helps!
Thank you in advance, sir /|\
nvm, i just fixed this by adding
use App\Commands\SendEmail;
To the top of the file...