예제 #1
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     Drive::creating(function ($drive) {
         // Make sure the user is logged in
         if (!Auth::check()) {
             return false;
         }
         // Check that the vehicle belongs to the learner
         if ($drive->getAttribute('vehicle_id')) {
             return $this->ownsVehicle($drive);
         }
         return true;
     });
 }