phpvms/app/Models/News.php

30 lines
439 B
PHP
Raw Normal View History

2018-01-08 23:02:55 +08:00
<?php
namespace App\Models;
use App\Contracts\Model;
class News extends Model
2018-01-08 23:02:55 +08:00
{
public $table = 'news';
2018-03-21 08:40:19 +08:00
protected $fillable = [
2018-01-08 23:02:55 +08:00
'user_id',
'subject',
'body',
];
public static $rules = [
'subject' => 'required',
'body' => 'required',
2018-01-08 23:02:55 +08:00
];
/**
* FOREIGN KEYS
*/
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
}