Skip to content

Instantly share code, notes, and snippets.

@harryWonder

harryWonder/User.php

Created Oct 19, 2020
Embed
What would you like to do?
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