123456789101112131415161718192021222324 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\SoftDeletes;
- class Article extends Model
- {
- use SoftDeletes;
- const STATUS_DRAFT = 0;
- const STATUS_PENDING = 1;
- const STATUS_PUBLISHED = 2;
- const STATUS_ARCHIVE = 3;
- function scopePending($query) {
- $query->where("status", static::STATUS_PENDING);
- }
- function scopePublished($query) {
- $query->where("status", static::STATUS_PUBLISHED);
- }
- }
|