| Current Path : /home/users/unlimited/www/dealnest.codeskitter.site/app/Models/ |
| Current File : /home/users/unlimited/www/dealnest.codeskitter.site/app/Models/User.php |
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'profile',
'email',
'password',
'type',
'permissions',
'slug_id'
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public function isActive()
{
if ($this->status == 1) {
return true;
}
return false;
}
public function getProfileAttribute($image)
{
// Check if $image is a valid URL
if (filter_var($image, FILTER_VALIDATE_URL)) {
return $image; // If $image is already a URL, return it as it is
} else {
// If $image is not a URL, construct the URL using configurations
return $image != '' ? url('') . config('global.IMG_PATH') . config('global.ADMIN_PROFILE_IMG_PATH') . $image : '';
}
}
}