Event::until PHP Method

until() public static method

Fire an event until the first non-null response is returned.
public static until ( string | object $event, array $payload = [] ) : mixed
$event string | object
$payload array
return mixed
        public static function until($event, $payload = array())
        {
            return \Illuminate\Events\Dispatcher::until($event, $payload);
        }

Usage Example

Example #1
0
 function get_dl($id = null)
 {
     $digitless = ltrim($id, '0..9');
     // file link can be either
     if ($digitless === '' or $digitless[0] === '.') {
         $file = File::find(strtok($id, '.'));
     } else {
         $file = File::where('name', '=', $id)->get();
     }
     if (!$file) {
         return;
     } elseif ($this->can('file.dl.deny.' . $file->id)) {
         return false;
     } else {
         $path = $file->file();
         $override = Event::until('file.dl.before', array(&$path, &$file, $this));
         if ($override !== null) {
             return $override;
         } elseif (!$file instanceof File) {
             return E_SERVER;
         } else {
             // In case the model was changed during event firing.
             $file->save();
             return Event::until('file.dl.response', array(&$path, $file, $this));
         }
     }
 }
All Usage Examples Of Event::until