create database in postgresql
udo -u postgres psql postgres=# create database mydb; postgres=# create user myuser with encrypted password ‘mypass’; postgres=# grant all privileges on database mydb to myuser;
udo -u postgres psql postgres=# create database mydb; postgres=# create user myuser with encrypted password ‘mypass’; postgres=# grant all privileges on database mydb to myuser;
$ sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add $ sudo sh -c ‘echo “deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 main” > /etc/apt/sources.list.d/pgadmin4.list && apt update’ $ sudo apt update $ sudo apt install pgadmin4-web $ sudo /usr/pgadmin4/bin/setup-web.sh
sudo apt-get install php libapache2-mod-php sudo a2enmod mpm_prefork && sudo a2enmod php7.0 sudo service apache2 restart
//check email / username exist or not let userExist = await User.findOne({$or: [ {email: req.body.email}, {username: req.body.username} ]}); if (userExist) { return res.status(400).json({ success: false, message: ‘User already exist in same email’ }); }
try { let users = await User.updateOne({ _id: req.params.id }).set({ email: ‘hhihhhjih@drtgt’ }); return res.status(200).json( { success: true, data: users } ); } catch (error) { return res.status(400).json( { success: false, message: error.message } ); }
const mongoose = require(‘mongoose’); const userSchema = new mongoose.Schema({ username: { type: String, // required: true, // unique: true }, email: { type: String, // required: true, // unique: true }, password: { type: String, }, firstname: { type: String, }, lastname: { type: String, }, address: { type: String, }, mobile: { type: String, …
What is the “__v” field in Mongoose – remove that field Read More »
php artisan vendor:publish –tag=laravel-errors result
=================================================================== Open your terminal using Ctrl+Alt+T and type the following commands Step 1: Install Laravel composer global require “laravel/installer” Step 2: Add composer to path to access laravel globally export PATH=”~/.config/composer/vendor/bin:$PATH” Step 3: Create a new Laravel application laravel new blog Step 4: Install missing packages and their dependencies cd blogcomposer install Step 5: Test the application …
<a href=“{{ URL(‘/students/edit/’.$student->id)}}“> <button class=“btn btn-primary”>Edit</button> </a>
<?php add_action( ‘wp_enqueue_scripts’, function () { wp_register_script( ‘my-script’, get_stylesheet_directory_uri() . ‘/assets/js/my-script.js’ ); wp_enqueue_script( ‘my-script’ ); } ); add_filter( ‘script_loader_tag’, function ( $tag, $handle ) { if ( ‘my-script’ !== $handle ) { return $tag; } return str_replace( ‘ src’, ‘ defer src’, $tag ); // defer the script //return str_replace( ‘ src’, ‘ async …
How to set defer or async attributes on enqueued script tags in WordPress Read More »