Skip to content
Advertisement

Tag: laravel

How to change Eloquent Builder’s connection?

I have a Eloquent Builder and two database connections(mysql_server1, mysql_server2) as below: Now how can I change the connection of $builder? Any helps would be appreciated Answer Need to get the Query from Eloquent Builder and set a new connection to that and set the new query to the Eloquent Builder as below:

Deploy error with Laravel project on Shared Hosting (Uncaught RuntimeException: A facade root has not been set)

I’m deploying a laravel project into production enviroment on a shared host using FTP following this tutorial except the creation of the symbolic link beacuse I’m not using the local storage but ran into “Uncaught RuntimeException: A facade root has not been set” error. Aditional info: I tried with a new laravel project with the command composer create-project laravel/laravel project_name

Method IlluminateDatabaseSchemaBlueprint::unsignedBidInteger does not exist

error in terminal C:xampphtdocslearninglaragonlavuedatabasemigrations2022_07_17_042348_create_transaction_details_table.php:18 IlluminateDatabaseSchemaBlueprint::__call() this my php migration }; When i put php artisan migration sees an error like above Answer There is a typo in your migration file on ‘transaction_id’ declaration. Your migration file should be like this. Check the line with the comment. Kindly read this.

Incorrect table definition; there can be only one auto column

Migration File After running php artisan migrate SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key (SQL: create table progress (id bigint unsigned not null auto_increment primary key, state_id bigint unsigned not null, city_id bigint unsigned not null, address text not null, project_name varchar(255)

Is there any way to use polymorphic relation, without the namespace FQDN

I have a polymorphic relationship and in my database i have one field called entity_type where the namespaces are saved ( models namespace for the polymorphic relationship ) like that normally : AppModelsMyModelName; Is there any way to use polymorphic relationship without the full FQDN, I would like to save only MyModelName instead of AppModelsMyModelsName Answer You can map these

how to simplify this complex query

This is an extract of one of my php functions. I’m struggling to get this optimized as is super slow, as I need to load all interview records, and then check if the current user is either assigned as user_id on the interview record, or if the user->id is in the interviews shared_user_ids which is json I’m also using PostgreSQL

Laravel On click Event Button [Enable button after upload file]

I have a table which contain two buttons, one is for uploading a file and the other one is for giving score. What I want to do is to give a condition for the second button which is the scoring button, whereby it can’t be clicked (disabled) if there is no file uploaded. How can I achieve this? Here is

Advertisement