Added email and password reset
This commit is contained in:
@@ -8,7 +8,7 @@ class Invoice extends Model
|
||||
{
|
||||
protected $table = 'ab_invoice';
|
||||
protected $dates = ['date_orig','due_date'];
|
||||
protected $with = ['items.taxes','items.product','items.service','account.country.currency','paymentitems'];
|
||||
protected $with = ['account.country.currency','items.product','items.service','items.taxes','paymentitems'];
|
||||
|
||||
protected $appends = [
|
||||
'date_due',
|
||||
|
@@ -12,16 +12,16 @@ class InvoiceItem extends Model
|
||||
|
||||
private $_tax = 0;
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
public function invoice()
|
||||
{
|
||||
return $this->belongsTo(Invoice::class);
|
||||
}
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
public function service()
|
||||
{
|
||||
return $this->belongsTo(Service::class);
|
||||
|
@@ -39,31 +39,54 @@ class Site extends Model
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$detail = $this->details->where('key',$key)->first();
|
||||
$detail = $this->getSiteDetailValue($key);
|
||||
|
||||
if ($detail) {
|
||||
return $detail->value;
|
||||
}
|
||||
return $detail->exists ? $detail->value : $this->getDefaultValue($key);
|
||||
}
|
||||
|
||||
// Suppress some default values
|
||||
$optional = [
|
||||
'block_quotes',
|
||||
'clients',
|
||||
'page_tabs',
|
||||
'services',
|
||||
'site_description',
|
||||
'site_fax',
|
||||
private function getDefaultValue($key)
|
||||
{
|
||||
$okblank = [
|
||||
'site_address2',
|
||||
'site_slider',
|
||||
'steps',
|
||||
'testimonials',
|
||||
'site_fax',
|
||||
'social',
|
||||
'top_menu'
|
||||
];
|
||||
|
||||
if (in_array($key,$optional))
|
||||
return '';
|
||||
if (! in_array($key,$okblank))
|
||||
Log::alert('Returning Default Value for Key:',['key'=>$key]);
|
||||
|
||||
Log::alert('Calling unknown Site Key:',['key'=>$key]);
|
||||
return array_get($this->_sampledata(),$key);
|
||||
// Suppress some default values
|
||||
$default = [
|
||||
'block_quotes' => '',
|
||||
'clients' => '',
|
||||
'page_tabs' => '',
|
||||
'services' => '',
|
||||
'site_description' => '',
|
||||
'site_fax' => '',
|
||||
'site_address2' => '',
|
||||
'site_slider' => '',
|
||||
'social' => [],
|
||||
'steps' => '',
|
||||
'testimonials' => '',
|
||||
'top_menu' => [],
|
||||
];
|
||||
|
||||
return array_get($default,$key);
|
||||
}
|
||||
|
||||
public function getSiteLogoAttribute()
|
||||
{
|
||||
$return = $this->getSiteDetailValue('site_logo')->value;
|
||||
|
||||
return $return ? 'storage/'.$return : '/image/generic/150/20/fff';
|
||||
}
|
||||
|
||||
private function getSiteDetailValue($key)
|
||||
{
|
||||
$return = $this->details->where('key',$key)->first();
|
||||
|
||||
return $return ?: (new SiteDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,10 +192,7 @@ class Site extends Model
|
||||
//'button'=>['text'=>'Purchase Now','url'=>'#'],
|
||||
],
|
||||
],
|
||||
'site'=>[
|
||||
'id'=>NULL,
|
||||
'logo'=>route('image',['width'=>128,'height'=>32,'color'=>'eee']),
|
||||
],
|
||||
'site_logo'=>route('image',['width'=>128,'height'=>32,'color'=>'eee']),
|
||||
'site_address1'=>'Building Name',
|
||||
'site_address2'=>NULL,
|
||||
'site_city'=>'City',
|
||||
@@ -237,7 +257,7 @@ class Site extends Model
|
||||
|
||||
public function sample()
|
||||
{
|
||||
return $this->forceFill(array_get($this->_sampledata(),'site'));
|
||||
return $this->forceFill($this->_sampledata());
|
||||
}
|
||||
|
||||
public function aboutus()
|
||||
@@ -279,9 +299,4 @@ class Site extends Model
|
||||
return join("\n",$this->_address());
|
||||
}
|
||||
}
|
||||
|
||||
public function logo_url()
|
||||
{
|
||||
return url($this->logo ? $this->logo : '/image/generic/150/20/fff');
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user