You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
858 B
32 lines
858 B
<?php
|
|
|
|
namespace App\Entities\Users;
|
|
|
|
use App\Entities\Users\UserPresenter;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Laracasts\Presenter\PresentableTrait;
|
|
|
|
class User extends Authenticatable
|
|
{
|
|
use Notifiable, PresentableTrait;
|
|
|
|
protected $fillable = ['name', 'email', 'password', 'api_token'];
|
|
protected $hidden = ['password', 'remember_token', 'api_token'];
|
|
protected $presenter = UserPresenter::class;
|
|
|
|
public function setPasswordAttribute($value)
|
|
{
|
|
$this->attributes['password'] = bcrypt($value);
|
|
}
|
|
|
|
public function nameLink()
|
|
{
|
|
return link_to_route('users.show', $this->name, [$this->id], ['target' => '_blank']);
|
|
}
|
|
|
|
public function agency()
|
|
{
|
|
return $this->hasOne('App\Entities\Agencies\Agency', 'owner_id');
|
|
}
|
|
}
|