Init(Core): Change repo

This commit is contained in:
2026-04-24 15:29:37 +03:30
commit ededb41a3a
1499 changed files with 199187 additions and 0 deletions

70
app/Models/User.php Normal file
View File

@@ -0,0 +1,70 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens;
use HasFactory;
use HasProfilePhoto;
use Notifiable;
protected $fillable = [
'name',
'mobile',
'is_admin',
'email',
'password',
];
protected $hidden = [
'password',
'remember_token',
];
protected $casts = [
'email_verified_at' => 'datetime',
];
protected $appends = [
'profile_photo_url',
];
public function subscribePlans()
{
return $this->hasMany(UserSubscriber::class);
}
public function isAdmin()
{
return $this->is_admin;
}
public function isSubscriber()
{
return $this->subscribePlans()->where('expired_at', '>', now())->exists();
}
public function subscribePlan()
{
return $this->subscribePlans()->where('expired_at', '>', now())->first();
}
public function userSubscribers()
{
return $this->hasMany(UserSubscriber::class);
}
public function notifications()
{
return $this->belongsToMany(Notification::class, 'notification_user')
->withPivot('read_at')
->withTimestamps();
}
}