12.02.2018 Views

laravel_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Laravel<br />

class HandleNewStudentAdded<br />

{<br />

protected $name;<br />

public function __construct()<br />

{<br />

//<br />

}<br />

public function handle(StudentAdded $event)<br />

{<br />

$this->name = $event->name;<br />

echo "New Student added in database with name: ".$this->name;<br />

}<br />

}<br />

Step 10: We now need to add the event class and its handler class in a file stored at<br />

app\Providers\EventServiceProvider.php. Notice the line in bold font and add that<br />

line in the file.<br />

app\Providers\EventServiceProvider.php<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!