2018-01-08 23:02:55 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2018-03-20 09:50:40 +08:00
|
|
|
use App\Interfaces\Model;
|
|
|
|
|
2018-01-08 23:02:55 +08:00
|
|
|
/**
|
|
|
|
* Class News
|
|
|
|
*/
|
2018-03-20 09:50:40 +08:00
|
|
|
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',
|
2018-03-20 09:50:40 +08:00
|
|
|
'body' => 'required',
|
2018-01-08 23:02:55 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* FOREIGN KEYS
|
|
|
|
*/
|
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
|
|
}
|
|
|
|
}
|