當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。