/** * The "booting" method of the model. * * @return void */ public static function boot() { parent::boot(); static::saving(function ($item) { $item->key = $item->key; }); }
protected static function boot() { parent::boot(); static::deleting(function ($image) { Storage::delete('uploads/m/' . $image->path . $image->key); }); }
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(); }); }
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(); }); }
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(); }); }
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('*****@*****.**', 'CompanyExchange'); $message->to($email); $message->subject('New Message on CompanyExchange'); }); } }); }
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('*****@*****.**', 'CompanyExchange'); $message->to($email); $message->subject('New Message Reply on CompanyExchange'); }); } }); }
/** * 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; }); }
/** * boot * observing model * */ public static function boot() { parent::boot(); Varian::observe(new VarianObserver()); }
public static function boot() { parent::boot(); Shipment::observe(new ShipmentObserver()); }
/** * boot * observing model * */ public static function boot() { parent::boot(); Calendar::observe(new CalendarObserver()); }
/** * boot * */ public static function boot() { parent::boot(); // Campaign::observe(new CampaignObserver()); }
public static function boot() { parent::boot(); // PersonDocument::observe(new PersonDocumentObserver()); }
/** * boot * */ public static function boot() { parent::boot(); Price::observe(new PriceObserver()); }
/** * boot * observing model * */ public static function boot() { parent::boot(); TransactionLog::observe(new TransactionLogObserver()); }
static function boot() { parent::boot(); Static::observe(new ContentObserver()); }
/** * boot * observing model * */ public static function boot() { parent::boot(); Template::observe(new TemplateObserver()); }
/** * boot * observing model * */ public static function boot() { parent::boot(); ProductExtension::observe(new ProductExtensionObserver()); }
/** * boot * observing model * */ public static function boot() { parent::boot(); Schedule::observe(new ScheduleObserver()); }
/** * boot * observing model * */ public static function boot() { parent::boot(); Api::observe(new ApiObserver()); }
/** * boot * observing model * */ public static function boot() { parent::boot(); FingerLog::observe(new FingerLogObserver()); }
public static function boot() { parent::boot(); UserInvitationLog::observe(new UserInvitationLogObserver()); }
/** * boot * */ public static function boot() { parent::boot(); }
static function boot() { parent::boot(); Static::observe(new AddressObserver()); }
/** * boot * observing model * */ public static function boot() { parent::boot(); Supplier::observe(new SupplierObserver()); }
static function boot() { parent::boot(); Static::observe(new WebsiteObserver()); }
public static function boot() { parent::boot(); Self::observe(new BaseObserver()); }
static function boot() { parent::boot(); Static::observe(new DirectoryObserver()); }
static function boot() { parent::boot(); Static::observe(new ImageObserver()); }
/** * boot * observing model * */ public static function boot() { parent::boot(); User::observe(new UserObserver()); }