CURRENT PATH:
/
home
/
u451283037
/
domains
/
rupandehiinstitute.com
/
public_html
/
subdomains
/
smarttraining
/
app
/
KEMBALI
|
HOME
Upload File Local:
Upload
Upload via URL:
Download
Dir Baru
File Baru
Editing:
User.php
<?php namespace App; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Laravel\Passport\HasApiTokens; use Spatie\Permission\Traits\HasRoles; class User extends Authenticatable { use Notifiable, HasRoles, HasApiTokens; /** * The attributes that are mass assignable. * * @var array */ protected $guarded = []; /** * 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', ]; /** * removing tokens * @param App\User * @return void */ public function revokeTokens() { $this->tokens()->each(function ($token) { $token->delete(); }); return; } public function branch() { return $this->belongsTo(Branch::class); } public function getPassword() { return $this->hasOne(UserPassword::class); } public function filterDataApi() { if ($this->branch_id) { $branch = $this->branch->name; } else { $branch = '-'; } return [ 'id' => $this->id, 'first_name' => $this->first_name, 'last_name' => $this->last_name, 'display_name' => $this->first_name . ' ' . $this->last_name, 'branch_name' => $branch, 'branch_id' => $this->branch_id, 'branch_name' => $this->branch->name, 'phone_no' => $this->phone_no != null ? $this->phone_no : '', 'email' => $this->email != null ? $this->email : '', 'gender' => $this->gender, 'address' => $this->address ?? $this->address, 'user_role' => $this->roles[0]['name'], 'profile_image' => $this->getProfileImage(), 'status' => $this->status ]; } public function getProfileImage() { if (empty($this->profile_image)) { return asset('public/images/logo.png'); } elseif (file_exists('public/' . $this->profile_image)) { return asset('public/' . $this->profile_image); } else { return asset('public/images/logo.png'); } } }
SIMPAN
BATAL