当前位置: 首页>>代码示例>>PHP>>正文


PHP BaseModel::boot方法代码示例

本文整理汇总了PHP中app\models\BaseModel::boot方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseModel::boot方法的具体用法?PHP BaseModel::boot怎么用?PHP BaseModel::boot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\BaseModel的用法示例。


在下文中一共展示了BaseModel::boot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: boot

 /**
  * The "booting" method of the model.
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     static::saving(function ($item) {
         $item->key = $item->key;
     });
 }
开发者ID:AccessibilityNL,项目名称:User-Testing-Tool,代码行数:12,代码来源:Member.php

示例2: boot

 protected static function boot()
 {
     parent::boot();
     static::deleting(function ($image) {
         Storage::delete('uploads/m/' . $image->path . $image->key);
     });
 }
开发者ID:sonoftheweb,项目名称:laravel-angular-cms,代码行数:7,代码来源:Media.php

示例3: boot

 public static function boot()
 {
     parent::boot();
     static::created(function ($course) {
         // 2016-09-01:应教务处要求添加公体选课统计,修改选课统计方式
         if ($isPubSport = Helper::isCourseType($course->kcxh, 'TB14')) {
             $count = Count::whereKcxh($course->kcxh)->first();
         } else {
             $count = Count::whereKcxh($course->kcxh)->whereZy($course->zy)->first();
         }
         if (count($count)) {
             $count->rs += 1;
         } else {
             $count = new Count();
             $count->kcxh = $course->kcxh;
             $count->zy = $isPubSport ? '' : $course->zy;
             $count->rs = 1;
         }
         $count->save();
         $log = new Slog();
         $log->kcxh = $course->kcxh;
         $log->ip = request()->ip();
         $log->czlx = 'insert';
         $log->save();
     });
     static::deleted(function ($course) {
         // 2016-09-01:应教务处要求添加公体选课统计,修改选课统计方式
         if ($isPubSport = Helper::isCourseType($course->kcxh, 'TB14')) {
             $count = Count::whereKcxh($course->kcxh)->first();
         } else {
             $count = Count::whereKcxh($course->kcxh)->whereZy($course->zy)->first();
         }
         if (count($count)) {
             $count->rs -= 1;
         } else {
             $count = new Count();
             $count->kcxh = $course->kcxh;
             $count->zy = $isPubSport ? '' : $course->zy;
             $count->rs = 0;
         }
         $count->save();
         $log = new Slog();
         $log->kcxh = $course->kcxh;
         $log->ip = request()->ip();
         $log->czlx = 'delete';
         $log->save();
     });
 }
开发者ID:rxfu,项目名称:student,代码行数:48,代码来源:Selcourse.php

示例4: boot

 public static function boot()
 {
     parent::boot();
     static::created(function ($exam) {
         $log = new Slog();
         $log->ip = request()->ip();
         $log->czlx = 'regist';
         $log->save();
     });
     static::deleted(function ($exam) {
         $log = new Slog();
         $log->ip = request()->ip();
         $log->czlx = 'cancel';
         $log->save();
     });
 }
开发者ID:rxfu,项目名称:student,代码行数:16,代码来源:Exregister.php

示例5: boot

 public static function boot()
 {
     parent::boot();
     static::created(function ($course) {
         $log = new Slog();
         $log->ip = request()->ip();
         $log->kcxh = $course->kcxh;
         $log->czlx = 'apply';
         $log->save();
     });
     static::deleted(function ($course) {
         $log = new Slog();
         $log->ip = request()->ip();
         $log->kcxh = $course->kcxh;
         $log->czlx = 'revoke';
         $log->save();
     });
 }
开发者ID:rxfu,项目名称:student,代码行数:18,代码来源:Application.php

示例6: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($message) {
         if ($message->receiver->email != null && $message->receiver->email != "") {
             $email = $message->receiver->email;
             $data['body'] = "You have a new message from {$message->sender->fullName}.<br>Please click the link below to go to your inbox/read message now<br>";
             $data['url']['title'] = 'View Message Now';
             $data['url']['link'] = url("inbox/{$message->id}");
             $data['title'] = 'You have a new message on CompanyExchange';
             Mail::queue('emails.templates.custom', $data, function ($message) use($email) {
                 $message->from('listings@ng.cx', 'CompanyExchange');
                 $message->to($email);
                 $message->subject('New Message on CompanyExchange');
             });
         }
     });
 }
开发者ID:remix101,项目名称:compex,代码行数:18,代码来源:Message.php

示例7: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($reply) {
         if ($reply->receiver->email != null && $reply->receiver->email != "") {
             $email = $reply->receiver->email;
             $data['body'] = "{$reply->sender->fullName} has just replied to your message on CompanyExchange.<br>Click the link below to view message now<br>";
             $data['url']['title'] = 'View Message';
             $data['url']['link'] = url("inbox/{$reply->message_id}");
             $data['title'] = 'You have a new reply on CompanyExchange';
             Mail::queue('emails.templates.custom', $data, function ($message) use($email) {
                 $message->from('listings@ng.cx', 'CompanyExchange');
                 $message->to($email);
                 $message->subject('New Message Reply on CompanyExchange');
             });
         }
     });
 }
开发者ID:remix101,项目名称:compex,代码行数:18,代码来源:MessageReply.php

示例8: boot

 /**
  * Listen for save event
  *
  * Saving permalink to history
  */
 protected static function boot()
 {
     parent::boot();
     static::saving(function (Article $model) {
         if ($model->getOriginal('permalink') !== $model->permalink && !is_null($model->permalink)) {
             $articlePermalink = new ArticlePermalink();
             $articlePermalink->permalink = $model->permalink;
             $articlePermalink->save();
         }
         return true;
     });
     static::saved(function (Article $model) {
         if ($model->getOriginal('permalink') !== $model->permalink && !is_null($model->permalink)) {
             $articlePermalink = ArticlePermalink::findOrFail($model->permalink);
             $model->permalinks()->save($articlePermalink);
         }
         return true;
     });
 }
开发者ID:TFidryForks,项目名称:spira,代码行数:24,代码来源:Article.php

示例9: boot

 /**
  * boot
  * observing model
  *
  */
 public static function boot()
 {
     parent::boot();
     Varian::observe(new VarianObserver());
 }
开发者ID:ThunderID,项目名称:SHOP-API,代码行数:10,代码来源:Varian.php

示例10: boot

 public static function boot()
 {
     parent::boot();
     Shipment::observe(new ShipmentObserver());
 }
开发者ID:ThunderID,项目名称:SHOP-API,代码行数:5,代码来源:Shipment.php

示例11: boot

 /**
  * boot
  * observing model
  *
  */
 public static function boot()
 {
     parent::boot();
     Calendar::observe(new CalendarObserver());
 }
开发者ID:ThunderID,项目名称:HRIS-API,代码行数:10,代码来源:Calendar.php

示例12: boot

 /**
  * boot
  *
  */
 public static function boot()
 {
     parent::boot();
     // Campaign::observe(new CampaignObserver());
 }
开发者ID:ThunderID,项目名称:SHOP-API,代码行数:9,代码来源:Campaign.php

示例13: boot

 public static function boot()
 {
     parent::boot();
     // PersonDocument::observe(new PersonDocumentObserver());
 }
开发者ID:ThunderID,项目名称:HRIS-API,代码行数:5,代码来源:PersonDocument.php

示例14: boot

 /**
  * boot
  *
  */
 public static function boot()
 {
     parent::boot();
     Price::observe(new PriceObserver());
 }
开发者ID:ThunderID,项目名称:SHOP-API,代码行数:9,代码来源:Price.php

示例15: boot

 /**
  * boot
  * observing model
  *
  */
 public static function boot()
 {
     parent::boot();
     TransactionLog::observe(new TransactionLogObserver());
 }
开发者ID:ThunderID,项目名称:SHOP-API,代码行数:10,代码来源:TransactionLog.php


注:本文中的app\models\BaseModel::boot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。