Skip to content
Advertisement

How to call Laravel Model function with parameter into Vuejs (for calculating stock Qunatity)?

I have three model 1.Fertilizer, 2. Fertilizer Stock, 3.Fertilizer Sale. 2 & 3 have foreign key relation(fertilizer_id) & mysql quantity column . I want to calculate individual Fertilizer stock quantity in my fertilizer model and append with fertilizerController in inertia index page. What’s Wrong with my code?

Controller

JavaScript

Model

JavaScript

Stock Function

JavaScript

Advertisement

Answer

Add this on your Fertilizer Model.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement