see the code trying to use the user model
class SendBirthdayMessage implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $user;
private $twilioClient;
/**
* Create a new job instance.
* @param User $user: A single user instance whose birthday is current date.
* @throws ConfigurationException
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
$sid = config('services.twilio.account_sid');
$token = config('services.twilio.auth_token');
$this->twilioClient = new Client($sid, $token);
}
then see what i am trying to implement
class SendDefaulterMessage implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $twilioClient;
private $defaulters = DB::table('forrent')
->join('landlord','forrent.LandLordID','=','landlord.LandLordID')
->join('tenant','forrent.AccountNo','=','tenant.AccountNo')
->join('property','tenant.PropertyID','=','property.PropertyID')
->select(DB::raw("CONCAT(landlord.Title,' ',landlord.OtherNames,' ',landlord.Surname) as Lfullname"),DB::raw("CONCAT(tenant.Title,' ',tenant.OtherNames,' ',tenant.Surname) as Tfullname"),'tenant.RegDate as RegDate', 'tenant.AccountNo as Accno','tenant.Rent as Rent', 'tenant.NoOfProperty as NoOfProperty','tenant.Address as Address','tenant.Phone as Phone','forrent.LastPeriod as LastPeriod','forrent.LPDate as Lp', 'property.Property as Property','property.Description as Description')
->get();
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($defaulters)
{
$this->defaulters = $defaulters;
$sid = config('services.twilio.account_sid');
$token = config('services.twilio.auth_token');
$this->twilioClient = new Client($sid, $token);
}
i get an error saying "Constant expression contains invalid operations". then i found out the issue as a result of the private defaulters variable. please does anybody know a way round this.