travel guide

This commit is contained in:
Kevin Adametz 2019-06-22 10:58:16 +02:00
parent 346a7427a5
commit a1ca534f55
26 changed files with 5788 additions and 3191 deletions

View file

@ -7,7 +7,7 @@
namespace App\Models;
use Carbon;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Storage;
use App\Services\Util;
@ -397,6 +397,30 @@ class TravelUserBookingFewo extends Model
return number_format(($total_pay - $first_pay + $this->getPriceDepositRaw()), 2, ',', '.');
}
public function getPriceTravelTotalPay(){
if($this->attributes['price_travel'] == 0){
return 0;
}
$total_pay = ($this->getPriceTravelTotalRaw() + $this->getPriceServiceRaw());
return number_format(($total_pay + $this->getPriceDepositRaw()), 2, ',', '.');
}
public function getDepartureInDays()
{
if(isset($this->attributes['from_date'])){
return Carbon::now()->diffInDays(Carbon::parse($this->attributes['from_date']), false);
}
return 0;
}
public function isFromDateAfterDays($days = 30){
if(($this->getDepartureInDays() - $days) > 0){
return true;
}
return false;
}
public function getBookingDateYear(){
return Carbon::parse($this->booking_date)->format('Y');