Monday, 29 January 2018

Getting SSH Key for Gitlab & Source Tree

Step 1 : Generate id_rsa public key by typing  : ssh-keygen -t rsa -b 4096 -c "youremail@com" on your command prompt.

Step 2 : Now open public key file and copy paste to gitlab at the ssh key section.

Step 3 : After that go to source tree and navigate to Tools > Add SSH key

Step 4 : Then check the connections  via "ssh -v"

Step 5 : If success,  you can now clone , pull, push or check out within your branches.

Step 6 : Otherwise, try git CLI to get it done manually if (Source Tree) problem occurs.

Working with Private Repo (GitLab)

To clone :

git clone

Tuesday, 23 January 2018

Redirect if not authenthicated laravel 5.4

the path is defined in app/Exceptions/Handler.php
     * Convert an authentication exception into an unauthenticated response.
     * @param  \Illuminate\Http\Request  $request
     * @param  \Illuminate\Auth\AuthenticationException  $exception
     * @return \Illuminate\Http\Response
    protected function unauthenticated($request, AuthenticationException $exception)
        if ($request->expectsJson()) {
            return response()->json(['error' => 'Unauthenticated.'], 401);

        return redirect()->guest('elsewhere');

Monday, 22 January 2018

Laravel 5.4 and higher version ( Specified key was too long when doing migration)

Specify a smaller length for your e-mail:
$table->string('email', 250);
Which is the default, actually:
And you should be good.
For Laravel 5.4 you can find a solution in this Laravel 5.4: Specified key was too long error, Laravel News post:
As outlined in the Migrations guide to fix this all you have to do is edit your AppServiceProvider.php file and inside the boot method set a default string length:
use Illuminate\Support\Facades\Schema;

public function boot()

Soure :

Upgrading to Laravel 5.5 with current project

Step 1 : Change php version that currently your localhost server using (Wamp = php 7.0)

enter image description here

Step 2 : Uninstall and install composer again and select the correct php version (7.0) while setup

enter image description here

Step 3 : If error still occur. Try using 'composer install --ignore-platform-reqs' to setup your project folder

Friday, 19 January 2018

npm run dev

Problem : laravel-5-4-cross-env-is-not-recognized-as-an-internal-or-external-command

You need to make cross-env working global instead of having in in the project.
1) remove node_modules folder
2) run
npm install --global cross-env
3) remove "cross-env": "^5.0.1", from package.json file devDependencies section. Actually, you can skip this step and keep package.json intact. If you prefer.
4) run
npm install --no-bin-links
5) run
npm run dev
and see it working

npm run gulp on root project

Some problems need to settle :

1. error cannot found module "browser-sync

Answer :

Tried these steps. Its work for me.
Globally install gulp.
Next need to install the project’s local dependencies (that’s where it’s looking for browser-sync). To do that,
cd into the project directory and run npm install.
Then try gulp serve.
You can also try following lines
npm i browser-sync --save then
npm start

2. error cannot found module "gulp-sass"

Just do npm update and then npm install gulp-sass --save-dev in your root folder, and then when you run you shouldn't have any issues.