Skip to content

Instantly share code, notes, and snippets.

@johngan
Last active October 27, 2016 00:17
Show Gist options
  • Save johngan/41d5465f81346e2aca2478908f7b8668 to your computer and use it in GitHub Desktop.
Save johngan/41d5465f81346e2aca2478908f7b8668 to your computer and use it in GitHub Desktop.
Laravel 5

###Composer Permission denied

  • Check the permissions of the directory /usr/local/bin/
  • Check the permissions of the project directory composer/*

The process has to write both, the file and into the directory which both must be granted.

Class some controller path does not exist

The API return error like this:

{
  "message": "Class Api\\Controllers\\AuthController does not exist",
  "status_code": 500,
  "debug": {
    "line": 280,
...
"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/",
        "Api\\": "app/Api/"
    }
},
$ composer dump-autoload

##Adding Font Awesome to app.scss ###In gulpfile.js

elixir(function(mix) {
    mix.sass('app.scss')
    ...
    .copy(
        'bower_components/font-awesome/fonts',
        'public/fonts');
});

###In app.scss

@import "bower_components/font-awesome/scss/font-awesome";

###Run gulp command

$ gulp
### error on running gulp first time
```
module.js:327
throw err;
^
Error: Cannot find module 'laravel-elixir'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
...
```
Delete `node_modules`, run `npm install` again

###Install Add this to composer.json

"require": {
  "tymon/jwt-auth": "0.5.*"
}
$ composer update

###Setup Add provider and alias to config/app.php

'providers' => [
    Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
],
'aliases'=>[
    'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
    'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
]

###Publish

$ php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"

###Generate Key

$ php artisan jwt:generate

###Location of generated key

// config/jwt.php
[
    'secret' => env('JWT_SECRET', 'your_personal_jwt_secret_key')
]

###Errors

Unable to boot ApiServiceProvider, configure an API domain or prefix.

Add this to .env file

API_PREFIX=api
$ php artisan config:cache

##MySQL environment ###MAMP mySQL location

/Applications/MAMP/Library/bin/mysql

###Setup $PATH in .bash_profile

export PATH=$PATH:/Applications/MAMP/Library/bin/

###Setup alias

alias="/Applications/MAMP/Library/bin/mysql"

###Map the namespace to laravel file path

"psr-4": {
            "App\\": "app/",
            "Api\\": "app/Api/"
        }

Now the Api namespace is pointed to app/Api directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment