12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Models\Member;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- use Illuminate\Notifications\Notifiable;
- use Laravel\Sanctum\HasApiTokens;
- use Spatie\Permission\Traits\HasRoles;
- class User extends Authenticatable
- {
- use HasApiTokens, HasFactory, Notifiable, SoftDeletes;
- protected $table = 'member_users';
- /**
- * The attributes that are mass assignable.
- *
- * @var array<int, string>
- */
- protected $fillable = [];
- protected $guarded = [];
- /**
- * The attributes that should be hidden for serialization.
- *
- * @var array<int, string>
- */
- protected $hidden = [
- 'password'
- ];
- /**
- * Get the attributes that should be cast.
- *
- * @return array<string, string>
- */
- protected function casts(): array
- {
- return [
- 'password' => 'hashed',
- 'login_date' => 'datetime'
- ];
- }
- public function getBalanceAttribute($value)
- {
- return number_format($value / 100, 2, '.', '');
- }
- public function coach(): \Illuminate\Database\Eloquent\Relations\HasOne
- {
- return $this->hasOne(\App\Models\Coach\User::class, 'user_id');
- }
- }
|