public static function boot() { parent::boot(); /* validation required on new */ static::creating(function ($model) { return $model->validate(); }); static::updating(function ($model) { return $model->validate(); }); }
public static function boot() { parent::boot(); static::creating(function ($model) { return $model->validate(); }); static::updating(function ($model) { return $model->validate(); }); static::deleted(function ($model) { $model->file->delete(); }); }
public static function boot() { parent::boot(); static::creating(function ($model) { if (!$model->validate()) { return false; } return true; }); static::created(function ($model) { event(new DepartmentCreated($model)); return true; }); static::updating(function ($model) { if (!$model->validate()) { return false; } return true; }); }
public static function boot() { parent::boot(); static::creating(function ($model) { if (!$model->validate()) { return false; } return true; }); static::updating(function ($model) { if (!$model->validate()) { return false; } return true; }); static::deleted(function ($model) { \File::delete(getcwd() . "/uploads/" . $model->fileCategory->name . "/" . $model->filename); return true; }); }
public static function boot() { parent::boot(); static::creating(function ($model) { if (!$model->validate()) { return false; } return true; }); static::created(function ($model) { $result = \File::makeDirectory(getcwd() . "/uploads/" . $model->name); return $result; }); static::updating(function ($model) { if (!$model->validate()) { return false; } return true; }); }
public static function boot() { parent::boot(); static::creating(function ($model) { if (!$model->validate()) { return false; } return true; }); static::created(function ($model) { event(new MotionCreated($model)); return true; }); static::updating(function ($model) { if (!$model->validate()) { return false; } event(new MotionUpdated($model)); return true; }); static::deleting(function ($model) { // before delete() method call this $model->votes()->delete(); $model->files()->delete(); }); }
public static function boot() { parent::boot(); /* validation required on new */ static::creating(function ($model) { if (!$model->validate()) { return false; } return true; }); static::created(function ($model) { $user = User::find($model->id); event(new UserCreated($user)); return true; }); static::updating(function ($model) { if (!$model->validate()) { return false; } event(new UserUpdating($model)); return true; }); static::updated(function ($model) { event(new UserUpdated($model)); $model->load('roles'); $data = ['event' => 'UserWithId' . $model->id . 'IsVerified', 'data' => ['permissions' => $model->permissions, 'identity_verified' => $model->identity_verified]]; Redis::publish('connection', json_encode($data)); return true; }); static::deleted(function ($model) { event(new UserDeleted($model)); return true; }); }
public static function boot() { parent::boot(); /* validation required on new */ static::creating(function ($model) { if (!$model->validate()) { return false; } if (!$model->motion->motionOpenForVoting) { $model->errors = "This motion is not open to voting"; return false; } return true; }); static::created(function ($model) { event(new VoteCreated($model)); return true; }); static::updating(function ($model) { if (!$model->validate()) { return false; } if (!$model->motion->motionOpenForVoting) { $model->errors = "This motion is no longer open to voting"; return false; } return true; }); static::updated(function ($model) { event(new VoteUpdated($model)); return true; }); static::deleting(function ($model) { event(new VoteDeleting($model)); return true; }); }
public static function boot() { parent::boot(); /* validation required on new */ static::creating(function ($model) { event(new CommentVoteCreated($model)); return $model->validate(); }); static::updating(function ($model) { event(new CommentVoteUpdated($model)); return $model->validate(); }); static::deleted(function ($model) { event(new CommentVoteDeleted($model)); return true; }); }
public static function boot() { parent::boot(); /* validation required on new */ static::creating(function ($model) { if (!$model->validate()) { return false; } return true; }); static::created(function ($model) { return true; }); static::updating(function ($model) { if (!$model->validate()) { return false; } return true; }); }