Created
October 19, 2020 20:17
-
-
Save harryWonder/1f804bef9a9da84719a4f0e6e51b9c43 to your computer and use it in GitHub Desktop.
This file is the User Model for the ld-fullstack blog topic.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use Laravel\Passport\HasApiTokens; | |
use Illuminate\Notifications\Notifiable; | |
use Illuminate\Contracts\Auth\MustVerifyEmail; | |
use Illuminate\Foundation\Auth\User as Authenticatable; | |
class User extends Authenticatable | |
{ | |
use HasApiTokens, Notifiable; | |
/** | |
* The attributes that are mass assignable. | |
* | |
* @var array | |
*/ | |
protected $fillable = [ | |
'name', 'email', 'password', | |
]; | |
/** | |
* The attributes that should be hidden for arrays. | |
* | |
* @var array | |
*/ | |
protected $hidden = [ | |
'password', 'remember_token', | |
]; | |
/** | |
* The attributes that should be cast to native types. | |
* | |
* @var array | |
*/ | |
protected $casts = [ | |
'email_verified_at' => 'datetime', | |
]; | |
public function forumModel() | |
{ | |
return $this->hasMany('App\Forum', 'user_id'); | |
} | |
public function comments() | |
{ | |
return $this->hasMany('App\Comment', 'user_id'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment