public function addedDiffPrice($diff, $priceTypeDiffHour) { $addedDiffHour = $diff - $priceTypeDiffHour; $addedPrice = 0; if ($addedDiffHour > 0 && $addedDiffHour <= 5) { $addedPrice = Pricing::where('type', 'hourly')->first()->price * $addedDiffHour; } return $addedPrice; }
/** * Run the database seeds. * * @return void */ public function run() { Pricing::truncate(); Pricing::create(['hour' => 1, 'price' => 30000, 'type' => 'hourly']); Pricing::create(['hour' => 12, 'price' => 100000, 'type' => 'halfDay']); Pricing::create(['hour' => 24, 'price' => 130000, 'type' => 'fullDay']); Pricing::create(['hour' => 48, 'price' => 208000, 'type' => 'additional1']); Pricing::create(['hour' => 72, 'price' => 312000, 'type' => 'additional2']); Pricing::create(['hour' => 96, 'price' => 416000, 'type' => 'additional3']); Pricing::create(['hour' => 120, 'price' => 520000, 'type' => 'additional4']); Pricing::create(['hour' => 144, 'price' => 624000, 'type' => 'additional5']); Pricing::create(['hour' => 168, 'price' => 682500, 'type' => 'weekly']); Pricing::create(['hour' => 720, 'price' => 2730000, 'type' => 'monthly']); }