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
Tag: laravel
Docker – Nginx, PHP, MySQL – Laravel artisan migrate connection refused
I have Laravel running in Docker with 3 containers – Nginx, MySQL 8 And PHP 8. I have the following docker-compose.yaml This command: Launches 3 containers: I want to run php artisan migrate, so I try it like so: This gives me the following error: My mysql.env file is like so: AND .env: I’ve tried changing ports, host, but I
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)
Failed to call XML Soap using PHP SoapClient
I’m trying to call SOAP xml using PHP SoapClient. However, I got the error of org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC connection; nested exception is org.apache….
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
How to check if related table doesn’t have record
matches table has releationship with scores table. I need to get all matches without record in scores table. tryied smth, but didint worked: Answer If you use relationship, you can use doesntHave() , but if you use query builder as you write in your question, you may use these codes, I saw that your where condition need some adjustment to
How to upload picture when register in laravel?
I’m trying to upload an image in laravel default user registration. I’m using laravel ui package. Here is create method in RegisterController I’m getting this error Undefined variable: image” Answer In the User model: