#### Category : postgresql

So iam trying to do a query in my laravel project but i cant figure out this query i think there is some sintax error or something can someone pls help? The tables: ac_settings ac_users_massages ac_profiles ac_massages I’m trying to do this query for a chat application in Laravel SELECT CASE WHEN COUNT(ACM.id) > 0 ..

basically i got a job as a junior developer and now they asked me to do a task doing this, but I have no idea on how to begin laravel MUST be on the local machine Sourc..

<?php namespace AppHttpControllers; use IlluminateHttpRequest; use DB; use AppModelsUser; use AppHttpRequests; use IlluminateSupportFacadesAuth; use AppHttpControllersController; use Redirect; class Insertlikes extends Controller { public function insertlikesform() { return view(‘dashboard’); } public function insertlike(Request $request) {$book_id = $request->input(‘book_id’);$user_id = Auth::user()->id; $user_name = Auth::user()->name; if(DB::select("select count(*) from likesrate where user_id=’$user_id’ and book_id=’$book_id’")==0) { DB::insert(‘insert into likesrate .. Read more I want to make validation which will allow to insert data which is exist on column ‘name’. For example. I have 1 row on column name which is equals to ‘test’. I try to insert ‘test1’, validation should prevent it, because ‘test1’ does not exist on column name. So, how can i do it? Source: .. Read more i have the next query with two subequery how can convert it to eloquent, i have some troubles with eloquent conversion :S. Thanks select * from (select * from ( select * from "public"."tabla_procesados" where "state" LIKE ‘%Failed%’ and id_execution = (select max(id_execution) from public.tabla_procesados) order by public.tabla_procesados.ts_start_processing desc ) a limit 1) b where .. Read more select s2.itemdesc, to_char(date_trunc(‘month’, saledate), ‘YYYY’) AS year, to_char(date_trunc(‘month’, saledate), ‘Month’) AS month, to_char(date_trunc(‘month’, saledate), ‘MM’) AS month_number, sum(qty) AS qty1 from sale s left join saled s2 on s.saleno = s2.saleno GROUP BY s2.itemdesc, date_trunc(‘month’, saledate) order by s2.itemdesc desc and month desc i have tried query in Postgresql Manager and its work. but i .. Read more I have a laravel project which was running using mySQL database and we plan to migrate to PostgreSQL, while migrating this is one of the error I have face, how can I tackle this? IlluminateDatabaseQueryException The auto-commit mode cannot be changed for this driver protected function createPdoConnection($dsn, $username,$password, $options) { if (class_exists(PDOConnection::class) && ! .. Read more Error: IlluminateDatabaseQueryException array_diff_key(): Argument #2 is not an array (SQL: select * from "pages" where "slug" = home and "pages"."deleted_at" is null limit 1) Imports use DoctrineDBALDriverPDOConnection; use Exception; use IlluminateDatabaseDetectsLostConnections; use PDO; use Throwable; Error Functions public function getOptions(array$config) { $options =$config[‘options’] ?? []; return array_diff_key($this->options,$options) + $options; } Options Variable .. Read more I need to resolve a query that has conditionals inside a join. Have 3 tables: companies – TABLE A id – name – type – code tributary_regime_codes – TABLE B id – code_category_id – code tributary_regime_codes_categories – TABLE C id – label – slug I need to make a query so that if the code .. Read more I’ve two questions. I’ve a standard Laravel docker installation but I’d love to move from Mysql db to Postgres. How to do it? I’ve installed Laravel using the default code curl -s "https://laravel.build/example-app" | bash I’m working on my new apple M1 macbook pro and my docker shows the alert "!amd64". Anyone knows how to .. Read more I have a Postgres Function which performs select query on a table to perform an arithmetic operation and calculate the result. I have setup pgbouncer before the postgresql server for better throughput. The System configurations are as follows. NGINX -> PHP-FPM -> Laravel 8 -> PgBouncer -> PostgreSQL 12 System Configuration AWS M6G.8X Large – .. Read more I made a normal CRUD app with Laravel 8 , it was working fine in my local machine , but when i deployed it on Heroku , and tried to Insert a user it gives me this error : IlluminateDatabaseQueryException: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "Utilisateurs" does not exist LINE 1: select count(*) as .. Read more I need to speed up PostgresSQL to process 3 Billion of row, every day it to processing 200 Million data. I use laravel to process. Is there any setting need to consider to speed up postgresql? I have server with 128G Ram and 40 core CPU. For information, i don’t have problem to use all .. Read more The id column in the student table is an auto incrementing one.I wanted to make that to non – autoincrementing. May i know, how can i modify the below query to work as such? DB::statement("ALTER TABLE student SET AUTO_INCREMENT=FALSE;"); the above code shows the below error. IlluminateDatabaseQueryException SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at .. Read more I am using PostgreSQL 12. I have ‘users’ table where ’email’ column is nullable means optional column, however it has unique constraint as expected. This ’email’ column is ‘citext’ type column. The problem is even I send ’email’ value as NULL, the database saves it as empty string instead NULL in ’email’ column during insert. .. Read more Schema::table(‘student’, function (Blueprint$table) { $table->dropColumn(‘id’); }); I wanted to delete the id column of student table. But this column is already referenced as foreign key(student_id) in table certificates.How can i do that?The above code shows the below error. IlluminateDatabaseQueryException SQLSTATE[2BP01]: Dependent objects still exist: 7 ERROR: cannot drop column id of table student because .. Read more I have two tables Infos and nationalities like this : 1) Table infos: id(pk) name nationality(varchar) accept multiple nationalities 1 John 1,2,3 2 Camilia 2,4 1) Table nationalities : id(pk) int desig 1 German 2 Turkey 3 Algeria 4 Qatar I want to get in the output something like this: desig count German 1 Turkey .. Read more I have a eloquent query with search. I need to search the value in two relations one in services.service_name and other in item.service name. on checking the item.service_name throwing error "cross-database references are not implemented". Am using laravel 8 with postgresql.$business->categories()->with([‘services.staffs’,’packages.packageItems.item’]) ->when(request()->filled(‘search’), function ($q) {$q->whereHas(‘services’, function ($q) {$q->where(‘services.service_name’, ‘ilike’, ‘%’ . request(‘search’) ..

When i tried to run php artisan migrate within my running container i got error like could not find driver that i think not properly installed postgres i included the code and error below help me to find this. My docker file FROM php:fpm-alpine RUN set -ex && apk –no-cache add postgresql-dev RUN docker-php-ext-install pdo ..

I am facing a issue when trying to connect to gcloud postgres db allowing ssl in my laravel application which is running in the cloud run. I downloaded all three cert files from gcloud and set the path in config/database.php. ‘driver’ => ‘pgsql’, ‘host’ => env(‘DB_HOST’, ‘127.0.0.1’), ‘port’ => env(‘DB_PORT’, ‘5432’), ‘database’ => env(‘DB_DATABASE’, ‘forge’), ..

wanted to ask how can I specify a value to start for bigincrements in laravel migration. I have to import a CSV with 200 rows and I hope it starts from 201 for new rows, but everytime it will start with 1 again when I create a new row after I imported the CSV to ..

Please help with code for dockerfile and docker-compose file i need laravel setup and postgres. This is my docker file FROM php:7.4 RUN apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev zlib1g-dev libpq-dev libxml2-dev libzip-dev libonig-dev graphviz && docker-php-ext-configure gd && docker-php-ext-install -j$(nproc) gd && docker-php-ext-install pdo_mysql && docker-php-ext-install pdo_psql && docker-php-ext-install zip .. Read more An eloquent model uses the following table and it is stored in a postgresql database: name: table id: PK SERIAL values: HSTORE And the model is named TableModel namespace App; use IlluminateDatabaseEloquentModel; class TableModel extends Model { protected$table = ‘table’; } But once I retrieve the value value I get the following response using ..