コード例 #1
0
ファイル: MotionFile.php プロジェクト: dwoodard/IserveU
 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();
     });
 }
コード例 #2
0
ファイル: Delegation.php プロジェクト: dwoodard/IserveU
 public static function boot()
 {
     parent::boot();
     /* validation required on new */
     static::creating(function ($model) {
         if (!$model->validate()) {
             return false;
         }
         return true;
     });
     static::updating(function ($model) {
         if (!$model->validate()) {
             return false;
         }
         return true;
     });
 }
コード例 #3
0
ファイル: Department.php プロジェクト: dwoodard/IserveU
 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;
     });
 }
コード例 #4
0
ファイル: File.php プロジェクト: dwoodard/IserveU
 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;
     });
 }
コード例 #5
0
ファイル: FileCategory.php プロジェクト: dwoodard/IserveU
 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;
     });
 }
コード例 #6
0
ファイル: Motion.php プロジェクト: vitz3/IserveU
 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();
     });
 }
コード例 #7
0
ファイル: User.php プロジェクト: vitz3/IserveU
 /**
  * @return Overrides the API Model, will see if it can be intergrated into it
  */
 public function getVisibleAttribute()
 {
     if (!Auth::check()) {
         return $this->visible;
     }
     if (Auth::user()->id == $this->id) {
         // Logged in user
         $this->visible = array_unique(array_merge($this->creatorVisible, $this->visible));
     }
     if ($this->public) {
         //Public profile
         $this->visible = array_unique(array_merge($this->publicVisible, $this->visible));
     }
     return parent::getVisibleAttribute();
 }
コード例 #8
0
ファイル: EthnicOrigin.php プロジェクト: dwoodard/IserveU
 public function toArray()
 {
     $this->getVisibleAttribute();
     return parent::toArray();
 }
コード例 #9
0
ファイル: Vote.php プロジェクト: dwoodard/IserveU
 /**
  * @return Overrides the API Model, will see if it can be intergrated into it
  */
 public function getVisibleAttribute()
 {
     //Should be manually run because ... fill this in if you can think of a reason
     if (Auth::user()->id == $this->user_id) {
         $this->setVisible = array_unique(array_merge($this->creatorVisible, $this->visible));
     }
     if ($this->user && $this->user->public) {
         //I'm really confused how a vote can not have a user somehow
         $this->setVisible = array_unique(array_merge($this->publicVisible, $this->visible));
     }
     return parent::getVisibleAttribute();
 }
コード例 #10
0
ファイル: BackgroundImage.php プロジェクト: dwoodard/IserveU
 /**
  * @return Overrides the API Model, will see if it can be intergrated into it
  */
 public function getVisibleAttribute()
 {
     if (!Auth::check()) {
         return $this->visible;
     }
     return parent::getVisibleAttribute();
 }
コード例 #11
0
ファイル: CommentVote.php プロジェクト: dwoodard/IserveU
 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;
     });
 }