| 1 | <?php |
||
| 11 | class Blog extends Model |
||
| 12 | { |
||
| 13 | use Notifiable; |
||
| 14 | use SoftDeletes; |
||
| 15 | |||
| 16 | protected $table = "blog"; |
||
| 17 | protected $dates = ['deleted_at']; |
||
| 18 | protected $fillable = [ |
||
| 19 | 'title', |
||
| 20 | 'content', |
||
| 21 | 'excerpt', |
||
| 22 | 'slug', |
||
| 23 | 'user_id', |
||
| 24 | ]; |
||
| 25 | |||
| 26 | protected $hidden = [ |
||
| 27 | 'deleted_at' |
||
| 28 | ]; |
||
| 29 | |||
| 30 | function __construct() |
||
| 34 | |||
| 35 | /** |
||
| 36 | * A Post belongs to a single User. |
||
| 37 | * |
||
| 38 | */ |
||
| 39 | public function user() |
||
| 43 | } |
||
| 44 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.