-
app/Models/Invoice.php
Open in GitHubclass Invoice extends Model { // public function setTotalPriceAttribute($value) { $this->attributes['total_price'] = $value * 100; } // }
-
app/Http/Controllers/InvoiceController.php
Open in GitHubuse App\Models\Invoice; use Carbon\Carbon; use Illuminate\Http\Request; class InvoiceController extends Controller { // public function store(Request $request) { $invoice = Invoice::create([ 'client_name' => $request->client_name, 'client_idnumber' => $request->client_idnumber, 'client_address' => $request->client_address, 'client_email' => $request->client_email, 'client_phone' => $request->client_phone, 'total_price' => $request->total_price, 'invoice_type_id' => $request->invoicetype, 'date' => $request->has('date') ? Carbon::parse($request->date) : Carbon::now(), ]); // } // }