28 lines
633 B
PHP
28 lines
633 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class SystemCommission extends BaseModel
|
|
{
|
|
//
|
|
public function getStatusNameAttribute(){
|
|
$type=config('adconfig.commission_status');
|
|
return $type[$this->status];
|
|
}
|
|
public function merchants(){
|
|
return $this->belongsTo('App\Models\Merchant','merchant_id','id');
|
|
}
|
|
public static function getOrCreate($data=[],$where){
|
|
$has_user=self::where($where)->first();
|
|
if(!empty($has_user))
|
|
{
|
|
return $has_user;
|
|
}else
|
|
{
|
|
return self::create($data);
|
|
}
|
|
}
|
|
}
|