Skip to content

Instantly share code, notes, and snippets.

@harryWonder
Created October 19, 2020 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harryWonder/1f804bef9a9da84719a4f0e6e51b9c43 to your computer and use it in GitHub Desktop.
Save harryWonder/1f804bef9a9da84719a4f0e6e51b9c43 to your computer and use it in GitHub Desktop.
This file is the User Model for the ld-fullstack blog topic.
<?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