Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current none :
/
proc
/
self
/
root
/
var
/
www
/
html
/
tpid-cinema-counter
/
app
/
Models
/
Or
Select Your none :
Upload File :
New :
File
Dir
//proc/self/root/var/www/html/tpid-cinema-counter/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; // Pastikan Anda telah menginstal spatie/laravel-permission // use Spatie\Permission\Traits\HasRoles; use Illuminate\Database\Eloquent\Relations\BelongsToMany; class User extends Authenticatable implements MustVerifyEmail { // Jika Anda menggunakan Spatie, jangan hapus komentar di bawah ini // use HasApiTokens, HasFactory, Notifiable, HasRoles; // Jika tidak, gunakan baris ini use HasApiTokens, HasFactory, Notifiable; /** * The attributes that are mass assignable. * * @var array<int, string> */ protected $fillable = [ 'name', 'email', 'password', 'role', 'production_house', 'last_login_at', 'last_login_ip', 'profile_photo_path', ]; /** * The attributes that should be hidden for serialization. * * @var array<int, string> */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @return array<string, string> */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'last_login_at' => 'datetime', 'password' => 'hashed', ]; } /** * Get the URL to the user's profile photo. * * @return string|null */ public function getProfilePhotoUrlAttribute(): ?string { if ($this->profile_photo_path) { // Asumsi Anda menggunakan disk 'public' untuk menyimpan foto profil return asset('storage/' . $this->profile_photo_path); } // Mengembalikan null jika tidak ada foto return null; } /** * The movies that belong to the user (producer). */ public function movies(): BelongsToMany { return $this->belongsToMany(Movie::class, 'movie_producer', 'user_id', 'movie_id'); } /** * Check if the user has the 'admin' role. */ public function isAdmin(): bool { return $this->role === 'admin'; } /** * Check if the user has the 'producer' role. */ public function isProducer(): bool { return $this->role === 'producer'; } }