Initial commit: WitShop Laravel Online-Shop
- Laravel 11, Blade, Alpine.js, Tailwind CSS - Produkt- & Kategorieverwaltung mit Varianten - Checkout (Vorkasse + Rechnung), Session-Warenkorb - Admin-Backend (Dashboard, Bestellungen, Kunden, CMS) - DSGVO-konform: Cookie-Consent, Impressum, Widerruf, AGB - PDF-Rechnung via dompdf, SMTP-Mailversand - Kundenverwaltung mit manueller Freischaltung Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ShippingRate extends Model
|
||||
{
|
||||
protected $fillable = ['name','zone','price','free_from','active'];
|
||||
|
||||
protected $casts = ['active' => 'boolean', 'price' => 'decimal:2', 'free_from' => 'decimal:2'];
|
||||
|
||||
public static function forCart(float $total, string $zone = 'DE'): ?self
|
||||
{
|
||||
return self::where('zone', $zone)->where('active', true)->first();
|
||||
}
|
||||
|
||||
public function getCostForTotal(float $total): float
|
||||
{
|
||||
if ($this->free_from !== null && $total >= (float) $this->free_from) {
|
||||
return 0.0;
|
||||
}
|
||||
return (float) $this->price;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user