Category : mysql

if (!Cache::store(‘file’)->has(‘channel’)) { $products = Channel::select(‘*’); Cache::store(‘redis’)->put(‘channel’, $products, 86400); } $products = Cache::store(‘redis’)->get(‘channel’, []); return DataTables::eloquent($products) ->addIndexColumn() ->make(true); This throws me "Serialization of ‘PDO’ is not allowed", if i am trying if (!Cache::store(‘file’)->has(‘channel’)) { $products = Channel::select(‘*’)->get(); Cache::store(‘redis’)->put(‘channel’, $products, 86400); } $products = Cache::store(‘redis’)->get(‘channel’, []); return DataTables::eloquent($products) ->addIndexColumn() ->make(true); then datatables throws error of Method ..

Read more

For example I have online store with keyboards and mouses tables. And on the product(keyboard or mouse) page I want to show Recommended to buy with… section where other product (keyboard or mouse) will appear. So on Keyboard#1 page may be recommended Keyboard#2 and Mouse#1, that means on Keyboard#2 and Mouse#1 pages will be recommended ..

Read more

This is the raw query "SELECT * FROM re_customer WHERE LOWER(email) = ‘" . $input[’email’] . "’ AND (password = SHA1(CONCAT(salt, SHA1(CONCAT(salt, SHA1(‘" . $input[‘password’] . "’))))) OR password = ‘" . md5( $input[‘password’] ) . "’) AND status = ‘1’"; I tried $customer = DB::connection( ‘oc’ ) ->table( Customer::$customerTable ) ->where( DB::raw( ‘LOWER(email)’ ), ..

Read more

Good day everyone, I’ve the following problem, I’m working on the back of a CRUD, currently I’ve to validate that the information entered by the user cannot be greater or less than what I’ve registered in each field of the database i.e it has to be equal to the database value, to verify this I ..

Read more

Trying to create Fake Posts by using tinker but met with the error code bellow IlluminateDatabaseQueryException with message ‘SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (posty.posts, CONSTRAINT posts_user_id_foreign FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE) (SQL: insert into posts (body, user_id, updated_at, created_at) ..

Read more

I am out of option . going through many solutions nothing worked . It has been asked by many people but nothing earlier solutions worked for me . .env DB_CONNECTION=mysql DB_HOST=db DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=root DB_PASSWORD=root config/database.php ‘mysql’ => [ ‘driver’ => ‘mysql’, ‘url’ => env(‘DATABASE_URL’), ‘host’ => env(‘DB_HOST’, ‘db’), ‘port’ => env(‘DB_PORT’, ‘3306’), ‘database’ => ..

Read more

i wanted to dockerize my laravel app. i launched two containers of mysql and php like this sudo docker pull mysql/mysql-server:latest sudo docker run –name=mysql -e MYSQL_ROOT_PASSWORD=mypass -d mysql/mysql-server:latest sudo docker pull phpmyadmin/phpmyadmin:latest sudo docker run –name phpmyadmin -d –link mysql:db -p 8081:80 phpmyadmin/phpmyadmin so i configured my user and imported my db manually in ..

Read more

I am using Laravel 8 and trying to get an application form to post to two tables in my database From my 2 database migration files: public function up() { Schema::create(‘applicants’, function (Blueprint $table) { $table->id(); $table->string(‘apptitle’); $table->string(‘firstname’); $table->string(‘middlename’)->nullable(); … $table->timestamps(); }); } public function up() { Schema::create(‘applications’, function (Blueprint $table) { $table->id(); $table->integer(‘applicant_id’); $table->integer(‘user_id’); ..

Read more