Download core/app/Models/Reviewer.php from pnacorp/codeplus: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/pnacorp/codeplus/resolve/main/core/app/Models/Reviewer.php
- Command line
-
hf download hf://pnacorp/codeplus/core/app/Models/Reviewer.php
-
curl -L -o Reviewer.php https://huggingface.co/pnacorp/codeplus/resolve/main/core/app/Models/Reviewer.php
1.31 kB
| namespace App\Models; | |
| use App\Constants\Status; | |
| use Illuminate\Database\Eloquent\Casts\Attribute; | |
| use Illuminate\Foundation\Auth\User as Authenticatable; | |
| class Reviewer extends Authenticatable | |
| { | |
| /** | |
| * The attributes that should be hidden for arrays. | |
| * | |
| * @var array | |
| */ | |
| protected $hidden = [ | |
| 'password', | |
| 'remember_token', | |
| ]; | |
| protected $casts = ['subcategories' => 'array']; | |
| public function scopeActive($query) | |
| { | |
| return $query->where('status', Status::ENABLE); | |
| } | |
| public function subCategories() | |
| { | |
| return $this->belongsToMany(SubCategory::class); | |
| } | |
| public function products() | |
| { | |
| return $this->hasMany(Product::class, 'assigned_to'); | |
| } | |
| public function approvedProducts() | |
| { | |
| return $this->hasMany(Product::class, 'approved_by'); | |
| } | |
| public function statusBadge(): Attribute | |
| { | |
| return new Attribute(function () { | |
| $html = ''; | |
| if ($this->status == Status::ENABLE) { | |
| $html = '<span class="badge badge--success">' . trans('Active') . '</span>'; | |
| } else { | |
| $html = '<span class="badge badge--danger">' . trans('Banned') . '</span>'; | |
| } | |
| return $html; | |
| }); | |
| } | |
| } | |