Promotion Frontend dynamic
This commit is contained in:
parent
c9e1545693
commit
1cc8e025a1
29 changed files with 551 additions and 163 deletions
|
|
@ -125,6 +125,19 @@ class PromotionAdmin extends Model
|
|||
}
|
||||
}
|
||||
|
||||
public function isActive(){
|
||||
if($this->active){
|
||||
if($this->from && Carbon::parse($this->from)->gt(Carbon::now()->startOfDay())){
|
||||
return false;
|
||||
}
|
||||
if($this->to && Carbon::parse($this->to)->lt(Carbon::now()->startOfDay())){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getFromAttribute($value)
|
||||
{
|
||||
if(!$value){ return ""; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue