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 Model Stock Function Answer Add this on your Fertilizer Model.
Tag: accessor
Laravel object value with Blade statement does not work if model has accessor
i have an Laravel object model with accessor: and i want to print the nomeAlimento value in a Blade page with Blade statement, for example: but the value inside the table cell is not printed, as if $planRow->foodName is null. In reality it is not empty, in fact if I print {{$planRow}} the structure of the object is complete, and
Laravel 6.11: Shopping cart HasMany::fisrt() in Accessor not working
EDIT: typos corrected (made while translating some of the code) I’m building a shopping cart with Laravel 6.11 (MAMP). I am getting a couple of errors that are driving me nuts. Please help! First I’…