Laravel 5.6 assign value to variable in blade template — May 21, 2018

Laravel 5.6 assign value to variable in blade template

for single line code

@php($testVar = 'somevalue';)

but if you want to write php code in multiple lines then you can use this

@php
$testVar = 'somevalue';
$testVar2 = 'somevalue';
@endphp
Advertisements
laravel 5.6 show last executed query — May 20, 2018

laravel 5.6 show last executed query

you need to do it like this

DB::enableQueryLog();
Model::insert(); // replace this with your query
dd(DB::getQueryLog());

So first we need to enable query logs in laravel.

laravel install doctrine/dbal —
Laravel 5.6 reset user password manually — May 5, 2018
wordpress Because your install is not new, the sites in your WordPress network must use sub-domains — April 30, 2018
WordPress Ubuntu not able to create directory — April 18, 2018

WordPress Ubuntu not able to create directory

There can be several reasons for this. One of those can be the file ownership issue. Explaining a way to solve it

First of all check which server user is accessing your files. You can check it by

echo exec('whoami');

Now go to your server terminal and change ownership of your wordpress installation directory to this user or group. In ubuntu like this

sudo chown -R user:group /var/www/wordpress

Other issue can be the file and directory permission issue. You can make directory permission to 755 or 775. So a user or user-group can create/edit/delete files from directories. You can do it this way.

find /var/www/wordpress -type d -exec chmod 755 {} \;

OR

find /var/www/wordpress -type d -exec chmod 775 {} \;
WordPress after migration keep redirecting to installation steps — April 13, 2018

WordPress after migration keep redirecting to installation steps

So I imagine that you have imported your DB and uploaded wordpress files to new server and You have changed the DB variables in wp-config.php. But it still redirect you to installation screen( check screenshot )
The only reason is that WordPress is not able to find its tables. It is able to connect to you DB but not able to find tables. This is because you have forgot to change ‘$table_prefix’ in your wp-config.php

$table_prefix  = 'wp_some_other_prefix';

I made this mistake too 🙂