示例#1
0
文件: Page.php 项目: jetcms/jetcms
<?php

namespace App;

use JetCMS\Models\Page as BaseModel;
use Carbon;
class Page extends BaseModel
{
}
/**
 * Sitemap
 */
Page::created(function ($model) {
    $url = Sitemap::where('loc', $model->url)->first();
    if (!$model->active and !$model->publish < Carbon::now()) {
        if ($url) {
            $url->delete();
        }
    }
});
Page::updated(function ($model) {
    $url = Sitemap::where('loc', $model->url)->first();
    if (!$model->active and !$model->publish < Carbon::now()) {
        if ($url) {
            $url->delete();
        }
    }
});