You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
3.3 KiB
83 lines
3.3 KiB
5 years ago
|
<?php
|
||
|
|
||
|
namespace App;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
||
|
class SiteConfig extends Model
|
||
|
{
|
||
|
protected $fillable = [
|
||
|
'site_id', 'gateway_data', 'e_namad_data', 'sms', 'seo', 'contact_us', 'other'
|
||
|
];
|
||
|
|
||
|
public $timestamps = false;
|
||
|
|
||
|
public function site()
|
||
|
{
|
||
|
return $this->belongsTo('App\Site');
|
||
|
}
|
||
|
|
||
|
public function getGatewayDataAttribute()
|
||
|
{
|
||
|
return json_decode($this->attributes['gateway_data']);
|
||
|
}
|
||
|
public function setGatewayDataAttribute($value)
|
||
|
{
|
||
|
$this->attributes['gateway_data'] = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||
|
}
|
||
|
public function getSmsAttribute()
|
||
|
{
|
||
|
return json_decode($this->attributes['sms']);
|
||
|
}
|
||
|
public function getENamadDataAttribute()
|
||
|
{
|
||
|
return json_decode($this->attributes['e_namad_data']);
|
||
|
}
|
||
|
public function setENamadDataAttribute($value)
|
||
|
{
|
||
|
$this->attributes['e_namad_data'] = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||
|
}
|
||
|
public function setSmsAttribute($value)
|
||
|
{
|
||
|
$this->attributes['sms'] = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||
|
}
|
||
|
public function getSeoAttribute()
|
||
|
{
|
||
|
return json_decode($this->attributes['seo']);
|
||
|
}
|
||
|
public function setSeoAttribute($value)
|
||
|
{
|
||
|
$this->attributes['seo'] = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||
|
}
|
||
|
public function getContactUsAttribute()
|
||
|
{
|
||
|
return json_decode($this->attributes['contact_us']);
|
||
|
}
|
||
|
public function setContactUsAttribute($value)
|
||
|
{
|
||
|
$this->attributes['contact_us'] = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||
|
}
|
||
|
public function getOtherAttribute()
|
||
|
{
|
||
|
$other = json_decode($this->attributes['other']);
|
||
|
$other = ($other) ? $other : collect() ;
|
||
|
|
||
|
$other->LoginColor = (isset($other->LoginColor)) ? $other->LoginColor : 'Cyan';
|
||
|
$other->LoginImage = (isset($other->LoginImage)) ? $other->LoginImage : 'WM-WebBuilder/Assets/Images/LoginPage.jpg';
|
||
|
$other->RegisterationColor = (isset($other->RegisterationColor)) ? $other->RegisterationColor : 'Red';
|
||
|
$other->SMSValidationColor = (isset($other->SMSValidationColor)) ? $other->SMSValidationColor : 'Orange';
|
||
|
$other->ForgotPasswordColor = (isset($other->ForgotPasswordColor)) ? $other->ForgotPasswordColor : 'Purple';
|
||
|
$other->ResetPasswordVerificationColor = (isset($other->ResetPasswordVerificationColor)) ? $other->ResetPasswordVerificationColor : 'Black';
|
||
|
$other->ResetPasswordColor = (isset($other->ResetPasswordColor)) ? $other->ResetPasswordColor : 'Black';
|
||
|
$other->ManagementHeaderImg = (isset($other->ManagementHeaderImg)) ? $other->ManagementHeaderImg : 'WM-Main/Assets/Uploads/Backgrounds/Admin-BG1.jpg';
|
||
|
$other->LoaderAddress = (isset($other->LoaderAddress)) ? $other->LoaderAddress : null;
|
||
|
$other->EmptyShoppingCart = (isset($other->EmptyShoppingCart)) ? $other->EmptyShoppingCart : (object) ['URL' => 'WM-Common/Assets/AnimatedIcons/Flower-Once.gif', 'Class' => ''];
|
||
|
$other->EmptyBusinessItem = (isset($other->EmptyBusinessItem)) ? $other->EmptyBusinessItem : (object) ['URL' => 'WM-Common/Assets/AnimatedIcons/Flower-Once.gif', 'Class' => ''];
|
||
|
return $other;
|
||
|
}
|
||
|
public function setOtherAttribute($value)
|
||
|
{
|
||
|
$this->attributes['other'] = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||
|
}
|
||
|
}
|