,

Create and Insert Invoices in Database using Laravel 10 and Vue.js 3 for a Simple Invoice Application

Posted by






Laravel 10 and Vuejs 3 – Simple Invoice Application

Laravel 10 and Vuejs 3 – Simple Invoice Application

In this tutorial, we will create a simple invoice application using Laravel 10 and Vuejs 3. We will start by creating a form to insert invoice data and then insert that data into the database.

Create Invoice

First, we will create a form to input the invoice details. We will use Vuejs 3 to bind the form fields to the data model and handle form submission.

“`html






“`

Insert Invoice in Database

Next, we will handle form submission and send the invoice data to the Laravel backend for insertion into the database.

“`php
// Laravel 10 Controller Method
public function create()
{
$invoice = new Invoice();
$invoice->invoiceNumber = request(‘invoiceNumber’);
$invoice->customerName = request(‘customerName’);
$invoice->amount = request(‘amount’);
$invoice->save();

return response()->json([‘message’ => ‘Invoice created successfully’]);
}
“`

With these steps, we have created a simple invoice application using Laravel 10 and Vuejs 3. We can now input invoice details through the form and insert them into the database using the Laravel backend.


0 0 votes
Article Rating
11 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Anze Sustar
1 year ago

Very nice series! Keep on going!
🙂

Gabriel Sáenz
1 year ago

Hi! i having a problem in 'customer_id' is passing the name instead of the id can you help me?

Tholfikar Mohammed
1 year ago

You don't need to use two functions and variables to open and close the modal, you can simply just toggle the showModal variable value directly while clicking the closing button.
@click="showModal = false",
just like this.

belkacem wordpress
1 year ago

can someone here give us the source of the new.vue file?, thank you

Al Mohands Mohammed
1 year ago

At the ninth minute, a problem with squiggles of red lines containing the Thai text appeared
Property 'customer_id' does not exist on type '{ $: ComponentInternalInstance; $data: {}; $props: Partial<{}> & Omit<Readonly<ExtractPropTypes<{}>> & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>; … 10 more …; $watch(source: string | Function, cb: Function, options?: WatchOptions<…> | undefined): WatchStopHandle; } & Readonly<…> & Sha…'.ts(2339)

min kogye
1 year ago

It's a really good video and very helpful for me but now i'm struggling in video no 7. i don't get how the new FormData() is appear at onsave function. can u explain me please? thank you so much!

Nguyen Tien Truong
1 year ago

hmm

Amazing Explorations
1 year ago

part 5 completed now moving part 6

Freak Ariyan
1 year ago

Please keep going for us

Mohammed Alamin
1 year ago

welcome back , please keep going

Freak Ariyan
1 year ago

First viewer and commenter from Bangladesh