for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Listeners;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class ComputeStudentLeadStatus
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
//
}
* Handle the event.
* @param object $event
public function handle($event)
//Get the student and update the lead status id
$enrollment = $event->enrollment;
$enrollment->student->lead_type_id = $enrollment->student->getLeadStatusAttribute();
$enrollment->student->save();