Skip to content
Advertisement

Tag: laravel

Laravel cut amount from rows before sum

I have column in my table where it stores prices and I need to sum those prices, the issue is I need to cut specific amount from each row before sum them. Example I don’t want to just sum this numbers, what I need is cut 5000 from each row value and then sum the rest. So my total after

Change Primary ID in laravel Migration

I’m creating a table where I want to use the ID from this table “menu_items” to be added in another table Table one: menu_items Table 2 products My aim of doing this is that I can then create a relationship between the 2 tables as they have the same key? Is there a different approach I can take? Should I

Laravel Auth:api will not persisting

I’m realizing platform web and app that work with Laravel 6 in back-end. I set auth web for platform web and auth api (with Laravel JWT) for the app. When I signin with app, Auth doesn’t persist and with subsequent calls I can’t to refresh the token nor to get user info. The code is below: routes/api.php AuthController.php Kernel middlewares

Can laravel make password encryption like mysql password() function?

how do I make password encryption on Laravel PHP to look like Mysql password() encryption? is there a way to do that? so I can create user to MySql using query on Laravel eloquent, and logged in to MySql using the user I create with Laravel? Answer No you can’t. because we can’t get MySQL user tables using eloquent (AFAIK)

Laravel Route Link – Error Route not Defined

In my web.php containing my routes, I have the following Route: Which links to my Profile Controller I am linking to this controller with However, when I navigate to the page with this route set, I get this error However, the following code works fine with navigation when I switch from route to URL Why does URL work but not

Laravel – How to query Eloquent relationship?

I have this models in Laravel-5.8: Then I have this Query in Employee controller function: How do I include where is_active = 1 from employee_types into the query in Employee: Answer You are looking for the whereHas method, querying for the existence of a relationship: Laravel 5.8 Docs – Eloquent – Relationships – Querying Relationship Existence whereHas

Advertisement