mirror of
https://github.com/brunofontes/shareit.git
synced 2024-11-24 12:17:10 +00:00
52 lines
994 B
PHP
52 lines
994 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Support\Facades\Request;
|
|
|
|
class User extends Authenticatable implements MustVerifyEmail
|
|
{
|
|
use 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',
|
|
];
|
|
|
|
public function products()
|
|
{
|
|
return $this->hasMany(Product::class);
|
|
}
|
|
|
|
public function items()
|
|
{
|
|
return $this->belongsToMany(Item::class);
|
|
}
|
|
|
|
/**
|
|
* Return the logged in user
|
|
*
|
|
* @return \App\User
|
|
*/
|
|
public static function loggedIn()
|
|
{
|
|
return (new static)->findOrFail(\Auth::id());
|
|
}
|
|
}
|