- Removed `UserDashboardController` and related user dashboard views. - Introduced `ExplorePageController` and redesigned `explore.blade.php` as the main user-facing page. - Updated routing logic to redirect users (non-admin and non-broker) to the `explore` page. - Added dedicated sidebar and layout components for the broker dashboard, improving structure and navigation.
72 lines
1.5 KiB
PHP
72 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
|
class User extends Authenticatable
|
|
{
|
|
/** @use HasFactory<\Database\Factories\UserFactory> */
|
|
use HasFactory, Notifiable;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'email',
|
|
'password',
|
|
'status',
|
|
'role',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be hidden for serialization.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
protected $hidden = [
|
|
'password',
|
|
'remember_token',
|
|
];
|
|
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'email_verified_at' => 'datetime',
|
|
'password' => 'hashed',
|
|
];
|
|
}
|
|
|
|
public function isBroker(): bool
|
|
{
|
|
return $this->type instanceof Broker;
|
|
}
|
|
|
|
public function deals(): HasMany
|
|
{
|
|
return $this->hasMany(Deal::class);
|
|
}
|
|
|
|
/**
|
|
* Returns model of User's role type
|
|
*/
|
|
public function type(): MorphTo
|
|
{
|
|
return $this->morphTo('role');
|
|
}
|
|
}
|