Laravel Classroom image

osdyui
 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4 | 5|Last
Lessons:-Events

12.2 Listen for an Event
To listen for an event we use the… yeah you probably guessed it. The listen() method. We
hand it the name of the event that we are looking for as a string, and as the second parameter a
closure to be performed when the event has been fired. The result of the closure will be passed
back as a response. Let’s take a look.
1 <?php
2
3 Event::listen('dinner.time', function() {
4 return 'thanks for the grub!';
5 });
If we now call $val = Event::first('dinner.time'); the value of $val will be thanks for
the grub!. Simple as that.

 
 
 

osdyui

Skills    Laravel

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)