64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use App\Models\User_sub;
|
|
use App\Models\UserMaterial;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Backpack\CRUD\CrudTrait; // <------------------------------- this one
|
|
use Spatie\Permission\Traits\HasRoles;// <---------------------- and this one
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
|
|
class User extends Authenticatable
|
|
{
|
|
use Notifiable;
|
|
use CrudTrait; // <----- this
|
|
use HasRoles; // <------ and this
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'email',
|
|
'password',
|
|
'phone',
|
|
'username'
|
|
];
|
|
|
|
/**
|
|
* 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 likes(){
|
|
return $this->hasMany(UserMaterial::class);
|
|
}
|
|
|
|
public function sendMail($crud = false)
|
|
{
|
|
//$address = route('sendMail',$this->id);
|
|
return "<a class='btn btn-xs btn-default' href='/sendMail/".$this->id."'
|
|
data-toggle='tooltip' title='Ullanyja mail ibermek'><i class='fa fa-send'></i> Mail</a>";
|
|
}
|
|
|
|
public function user_sub(){
|
|
return $this->hasOne(User_sub::class);
|
|
}
|
|
}
|