PATH:
home
/
lab2454c
/
omvstudio.com
/
app
/
Models
<?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; use Illuminate\Contracts\Auth\MustVerifyEmail; use Laravel\Cashier\Billable; use Carbon\Carbon; class User extends Authenticatable implements MustVerifyEmail { use HasApiTokens, HasFactory, Notifiable, Billable; /** * The attributes that are mass assignable. * * @var array<int, string> */ protected $fillable = [ 'first_name', 'last_name', 'username', 'phone_number', 'profile_picture', 'role_id', 'email', 'password', 'role_id', 'account_status', 'hear_from', 'refer_by' ]; /** * 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 role() { return $this->belongsTo(Role::class); } public function payments() { return $this->hasMany(Payment::class); } public function reviews() { return $this->hasMany(Review::class,'user_id'); } /*public function Check24Hrs() { if (!empty($this->payments->sortByDesc('created_at')->first()) AND ($this->payments->sortByDesc('created_at')->first()->payment_validity > \Carbon\Carbon::now())) { return true; } else { return false; } }*/ public function referBy() { return $this->belongsTo(User::class, 'refer_by', 'id'); } public function referrals() { return $this->hasMany(User::class, 'refer_by', 'id'); } public function bankDetail() { return $this->hasOne(BankDetail::class,'user_id'); } public function receivedReferralPayments() { return $this->hasMany(ReferralPayment::class,'refer_by'); } public function sentReferralPayments() { return $this->hasMany(ReferralPayment::class, 'refer_to'); } public function getCreatedAtAttribute($value) { return Carbon::createFromFormat('Y-m-d H:i:s',$value)->format('d/m/Y H:ia'); } public function IsOneTime() { if ($this->is_one_time == 1) { return true; } else { return false; } } public function movies() { return $this->belongsToMany(Movie::class,'movie_user')->withPivot('created_at','updated_at'); } }
[-] Message.php
[edit]
[-] Entertain.php
[edit]
[-] Review.php
[edit]
[+]
..
[-] HomeConfigWork.php
[edit]
[-] Category.php
[edit]
[-] MusicMania.php
[edit]
[-] Faq.php
[edit]
[-] Sport.php
[edit]
[-] Contact.php
[edit]
[-] Page.php
[edit]
[-] Media.php
[edit]
[-] Payment.php
[edit]
[-] Music.php
[edit]
[-] User.php
[edit]
[-] SiteSetting.php
[edit]
[-] PageBanner.php
[edit]
[-] BankDetail.php
[edit]
[-] ReferralPayment.php
[edit]
[-] Movie.php
[edit]
[-] Role.php
[edit]