|
@@ -9,13 +9,22 @@ class Comment extends Model
|
|
|
{
|
|
|
use SoftDeletes;
|
|
|
|
|
|
+ const STATUS_PENDING = 0;
|
|
|
+ const STATUS_PUBLISHED = 1;
|
|
|
+ const STATUS_REJECTED = 2;
|
|
|
+
|
|
|
|
|
|
protected $fillable = [
|
|
|
"name",
|
|
|
"email",
|
|
|
- "content"
|
|
|
+ "content",
|
|
|
+ "status"
|
|
|
];
|
|
|
|
|
|
+ function scopePublished($query) {
|
|
|
+ $query->where("status", static::STATUS_PUBLISHED);
|
|
|
+ }
|
|
|
+
|
|
|
function scopeRecent($query) {
|
|
|
$query->orderBy("created_at", "desc");
|
|
|
}
|