Promotion Frontend dynamic

This commit is contained in:
Kevin Adametz 2021-11-26 18:23:10 +01:00
parent c9e1545693
commit 1cc8e025a1
29 changed files with 551 additions and 163 deletions

View file

@ -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 ""; }