mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-09-28 09:13:05 -04:00
61 lines
1.4 KiB
PHP
61 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Modules\JobPortal\Entities;
|
|
|
|
use Modules\JobPortal\Entities\BaseModel;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use App\Models\User;
|
|
|
|
class VendorPayout extends BaseModel
|
|
{
|
|
use SoftDeletes;
|
|
|
|
const PENDING = 'pending';
|
|
|
|
protected $table = 'jp_vendor_payouts';
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $casts = [
|
|
'account_info'=>'array'
|
|
];
|
|
|
|
public static function getAllStatuses(){
|
|
return [
|
|
'pending'=>[
|
|
'title'=>__("Pending")
|
|
],
|
|
'paid'=>[
|
|
'title'=>__("Paid")
|
|
],
|
|
'rejected'=>[
|
|
'title'=>__("Rejected")
|
|
],
|
|
];
|
|
}
|
|
|
|
public function calculateTotal(){
|
|
$this->total = GigOrder::query()
|
|
->where('payout_id',$this->id)
|
|
->sum('total');
|
|
$this->save();
|
|
}
|
|
|
|
public function candidate(){
|
|
return $this->belongsTo(\App\Models\User::class,'vendor_id');
|
|
}
|
|
public function getMethodNameAttribute(){
|
|
$all = setting_item_array('vendor_payout_methods');
|
|
foreach ($all as $item){
|
|
if(!isset($item['id'])) continue;
|
|
if($item['id'] == $this->payout_method) return $item['name'] ?? '';
|
|
}
|
|
return $this->payout_method;
|
|
}
|
|
|
|
public static function isEnable(){
|
|
return setting_item('disable_payout') == false;
|
|
}
|
|
}
|