├── .env.example
├── .gitattributes
├── .gitignore
├── app
├── Console
│ ├── Commands
│ │ └── Inspire.php
│ └── Kernel.php
├── Events
│ └── Event.php
├── Exceptions
│ ├── Handler.php
│ ├── JWTAbsentException.php
│ ├── JWTExpiredException.php
│ ├── JWTInvalidException.php
│ └── JWTUserNotFoundException.php
├── Http
│ ├── Controllers
│ │ └── Api
│ │ │ └── v1
│ │ │ ├── AuthController.php
│ │ │ ├── Controller.php
│ │ │ └── UserController.php
│ ├── Kernel.php
│ ├── Middleware
│ │ ├── Authenticate.php
│ │ ├── Cors.php
│ │ ├── EncryptCookies.php
│ │ ├── RedirectIfAuthenticated.php
│ │ └── VerifyCsrfToken.php
│ ├── Requests
│ │ ├── AuthRegisterRequest.php
│ │ ├── Request.php
│ │ └── UserAllRequest.php
│ └── routes.php
├── Jobs
│ └── Job.php
├── Listeners
│ └── .gitkeep
├── Models
│ ├── MongoModel.php
│ └── User.php
├── Policies
│ ├── .gitkeep
│ └── .gitkeep (1)
└── Providers
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
├── artisan
├── bootstrap
├── app.php
├── autoload.php
└── cache
│ └── .gitignore
├── composer.json
├── composer.lock
├── config
├── app.php
├── auth.php
├── broadcasting.php
├── cache.php
├── compile.php
├── database.php
├── filesystems.php
├── jwt.php
├── mail.php
├── queue.php
├── services.php
├── session.php
└── view.php
├── database
├── .gitignore
├── factories
│ └── ModelFactory.php
├── migrations
│ ├── .gitkeep
│ └── 2014_10_12_000000_create_users_table.php
└── seeds
│ ├── .gitkeep
│ └── DatabaseSeeder.php
├── gulpfile.js
├── package.json
├── phpunit.xml
├── public
├── .htaccess
├── favicon.ico
├── index.php
├── robots.txt
└── web.config
├── readme.md
├── resources
├── assets
│ └── sass
│ │ └── app.scss
├── lang
│ └── en
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
└── views
│ ├── errors
│ └── 503.blade.php
│ └── welcome.blade.php
├── server.php
├── storage
├── app
│ ├── .gitignore
│ └── public
│ │ └── .gitignore
├── framework
│ ├── .gitignore
│ ├── cache
│ │ └── .gitignore
│ ├── sessions
│ │ └── .gitignore
│ └── views
│ │ └── .gitignore
└── logs
│ └── .gitignore
└── tests
├── ExampleTest.php
└── TestCase.php
/.env.example:
--------------------------------------------------------------------------------
1 | APP_ENV=local
2 | APP_DEBUG=true
3 | APP_KEY=SomeRandomString
4 | APP_URL=http://localhost
5 |
6 | DB_CONNECTION=mysql
7 | DB_HOST=127.0.0.1
8 | DB_PORT=3306
9 | DB_DATABASE=homestead
10 | DB_USERNAME=homestead
11 | DB_PASSWORD=secret
12 |
13 | CACHE_DRIVER=file
14 | SESSION_DRIVER=file
15 | QUEUE_DRIVER=sync
16 |
17 | REDIS_HOST=127.0.0.1
18 | REDIS_PASSWORD=null
19 | REDIS_PORT=6379
20 |
21 | MAIL_DRIVER=smtp
22 | MAIL_HOST=mailtrap.io
23 | MAIL_PORT=2525
24 | MAIL_USERNAME=null
25 | MAIL_PASSWORD=null
26 | MAIL_ENCRYPTION=null
27 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.scss linguist-vendored
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 | /node_modules
3 | /public/storage
4 | Homestead.yaml
5 | Homestead.json
6 | .env
7 |
--------------------------------------------------------------------------------
/app/Console/Commands/Inspire.php:
--------------------------------------------------------------------------------
1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')
28 | // ->hourly();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/Events/Event.php:
--------------------------------------------------------------------------------
1 | getResponse();
50 | }
51 |
52 | $class = get_class($e);
53 |
54 | switch($class) {
55 | case 'Illuminate\\Http\\Exception\\HttpResponseException':
56 | return parent::render($request, $e);
57 | break;
58 | case 'Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException':
59 | $code = 'NotFound';
60 | $msg = 'Not Found.';
61 | $statusCode = 404;
62 | break;
63 | case 'Illuminate\Database\Eloquent\ModelNotFoundException':
64 | $code = 'ModelNotFound';
65 | $model = str_replace('App\\Models\\', '', $e->getModel());
66 | $msg = $model . ' not found.';
67 | $statusCode = 404;
68 | break;
69 | case 'Illuminate\Auth\Access\AuthorizationException':
70 | $code = 'InvalidCredentials';
71 | $msg = 'Credentials are invalid.';
72 | $statusCode = 400;
73 | break;
74 | case 'Tymon\JWTAuth\Exceptions\JWTException';
75 | $code = 'JWTException';
76 | $msg = 'There was an issue generating jwt tokens.';
77 | $statusCode = 400;
78 | break;
79 | case 'App\Exceptions\JWTAbsentException';
80 | $code = 'TokenAbsent';
81 | $msg = 'The token is absent.';
82 | $statusCode = 400;
83 | break;
84 | case 'App\Exceptions\JWTExpiredException';
85 | $code = 'TokenExpired';
86 | $msg = 'The token has expired.';
87 | $statusCode = 401;
88 | break;
89 | case 'App\Exceptions\JWTInvalidException';
90 | $code = 'InvalidToken';
91 | $msg = 'The token is invalid.';
92 | $statusCode = 401;
93 | break;
94 | case 'App\Exceptions\JWTUserNotFoundException';
95 | $code = 'UserNotFound';
96 | $msg = 'The user token does not match.';
97 | $statusCode = 404;
98 | break;
99 | default:
100 | $code = 'SystemError';
101 | $msg = $e->getMessage();
102 | $file = $e->getFile();
103 | $line = $e->getLine();
104 | $statusCode = 500;
105 | }
106 |
107 | $data = [
108 | 'status' => 'error',
109 | 'exception' => $class,
110 | 'code' => $code,
111 | 'msg' => $msg
112 | ];
113 |
114 | if (isset($file)) {
115 | $data['file'] = $file;
116 | }
117 |
118 | if (isset($line)) {
119 | $data['line'] = $line;
120 | }
121 |
122 | return response($data, $statusCode)
123 | ->header('Access-Control-Allow-Origin', '*')
124 | ->header('Access-Control-Allow-Headers', 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With')
125 | ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/app/Exceptions/JWTAbsentException.php:
--------------------------------------------------------------------------------
1 | username = $request->get('username');
21 | $user->password = \Hash::make($request->get('password'));
22 | $user->save();
23 |
24 | return response([
25 | 'status' => 'success',
26 | 'data' => $user
27 | ], 200);
28 | }
29 |
30 | public function login(Request $request)
31 | {
32 | $credentials = $request->only('username', 'password');
33 |
34 | if ( ! $token = JWTAuth::attempt($credentials)) {
35 | return response([
36 | 'status' => 'error',
37 | 'error' => 'invalid.credentials',
38 | 'msg' => 'Invalid Credentials.'
39 | ], 400);
40 | }
41 |
42 | return response([
43 | 'status' => 'success'
44 | ])
45 | ->header('Authorization', $token);
46 | }
47 |
48 | public function impersonate(Request $request)
49 | {
50 | $user = User::find($request->get('id'));
51 |
52 | if ( ! $token = JWTAuth::fromUser($user)) {
53 | return response([
54 | 'status' => 'error',
55 | 'error' => 'invalid.credentials',
56 | 'msg' => 'Invalid Credentials.'
57 | ], 404);
58 | }
59 |
60 | return response([
61 | 'status' => 'success'
62 | ])
63 | ->header('Authorization', $token);
64 | }
65 |
66 | public function user(Request $request)
67 | {
68 | $user = User::find(Auth::user()->id);
69 |
70 | return response([
71 | 'status' => 'success',
72 | 'data' => $user
73 | ]);
74 | }
75 |
76 | public function logout()
77 | {
78 | // JWTAuth::invalidate();
79 |
80 | return response([
81 | 'status' => 'success',
82 | 'msg' => 'Logged out Successfully.'
83 | ], 200);
84 | }
85 |
86 | public function facebook(Request $request)
87 | {
88 | return $this->_social($request, 'facebook', function ($user) {
89 | return (object) [
90 | // 'id' => $user->id,
91 | // 'email' => $user->user['email'],
92 | // 'first_name' => $user->user['first_name'],
93 | // 'last_name' => $user->user['last_name'],
94 | // 'photo_url' => $user->avatar . '&width=1200'
95 | ];
96 | });
97 | }
98 |
99 | public function google(Request $request)
100 | {
101 | return $this->_social($request, 'google', function ($user) {
102 | return (object) [
103 | // 'id' => $user->id,
104 | // 'email' => $user['emails'][0]['value'],
105 | // 'first_name' => $user['name']['givenName'],
106 | // 'last_name' => $user['name']['familyName'],
107 | // 'photo_url' => array_get($user, 'image')['url'] . '&width=1200'
108 | ];
109 | });
110 | }
111 |
112 | public function buffer(Request $request)
113 | {
114 | return $this->_social($request, 'buffer', function ($user) {
115 | return (object) [
116 | // 'id' => $user->id,
117 | // 'first_name' => $user->name,
118 | // 'last_name' => null,
119 | // 'email' => $user->email ?: null,
120 | // 'photo_url' => $user->avatar,
121 | ];
122 | });
123 | }
124 |
125 | private function _social(Request $request, $type, $cb)
126 | {
127 | if ($request->has('code')) {
128 | // $new_user = false;
129 |
130 | // $social_user = Socialite::with($type)->stateless()->user();
131 | // $social_user = $cb($social_user);
132 |
133 | // if ( ! @$social_user->id) {
134 | // return response([
135 | // 'status' => 'error',
136 | // 'code' => 'ErrorGettingSocialUser',
137 | // 'msg' => 'There was an error getting the ' . $type . ' user.'
138 | // ], 400);
139 | // }
140 |
141 | // $user = User::where($type . '_id', $social_user->id)->first();
142 |
143 | // if ( ! ($user instanceof User)) {
144 | // $user = User::where('email', $social_user->email)->first();
145 |
146 | // if ( ! ($user instanceof User)) {
147 | // $new_user = true;
148 | // $user = new User();
149 | // }
150 |
151 | // $user->{$type . '_id'} = $social_user->id;
152 | // }
153 |
154 | // // Update info and save.
155 |
156 | // if (empty($user->email)) { $user->email = $social_user->email; }
157 | // if (empty($user->first_name)) { $user->first_name = $social_user->first_name; }
158 | // if (empty($user->last_name)) { $user->last_name = $social_user->last_name; }
159 |
160 | $user = User::where('username', 'social')->first();
161 |
162 | if ( ! $token = JWTAuth::fromUser($user)) {
163 | throw new AuthorizationException;
164 | }
165 |
166 | return response([
167 | 'status' => 'success',
168 | 'msg' => 'Successfully logged in via ' . $type . '.'
169 | ])
170 | ->header('Authorization', $token);
171 | }
172 |
173 | return response([
174 | 'status' => 'success',
175 | 'msg' => 'Successfully fetched token url.',
176 | 'data' => [
177 | 'url' => Socialite::with($type)->stateless()->redirect()->getTargetUrl()
178 | ]
179 | ], 200);
180 | }
181 |
182 | public function refresh()
183 | {
184 | return response([
185 | 'status' => 'success'
186 | ]);
187 | }
188 | }
--------------------------------------------------------------------------------
/app/Http/Controllers/Api/v1/Controller.php:
--------------------------------------------------------------------------------
1 | limit(50)->get();
14 |
15 | return response([
16 | 'status' => 'success',
17 | 'data' => [
18 | 'items' => $users
19 | ]
20 | ]);
21 | }
22 | }
--------------------------------------------------------------------------------
/app/Http/Kernel.php:
--------------------------------------------------------------------------------
1 | [
27 | // \App\Http\Middleware\EncryptCookies::class,
28 | // \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
29 | // \Illuminate\Session\Middleware\StartSession::class,
30 | // \Illuminate\View\Middleware\ShareErrorsFromSession::class,
31 | // \App\Http\Middleware\VerifyCsrfToken::class,
32 | ],
33 |
34 | 'api' => [
35 | 'throttle:60,1',
36 | ],
37 | ];
38 |
39 | /**
40 | * The application's route middleware.
41 | *
42 | * These middleware may be assigned to groups or used individually.
43 | *
44 | * @var array
45 | */
46 | protected $routeMiddleware = [
47 | // 'auth' => \App\Http\Middleware\Authenticate::class,
48 | // 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
49 | // 'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
50 | // 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
51 | // 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
52 | 'session' => \Illuminate\Session\Middleware\StartSession::class,
53 | 'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
54 | 'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,
55 | 'cors' => \App\Http\Middleware\Cors::class,
56 | ];
57 | }
58 |
--------------------------------------------------------------------------------
/app/Http/Middleware/Authenticate.php:
--------------------------------------------------------------------------------
1 | guest()) {
21 | if ($request->ajax() || $request->wantsJson()) {
22 | return response('Unauthorized.', 401);
23 | } else {
24 | return redirect()->guest('login');
25 | }
26 | }
27 |
28 | return $next($request);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/Http/Middleware/Cors.php:
--------------------------------------------------------------------------------
1 | header('Access-Control-Allow-Origin', '*')
13 | ->header('Access-Control-Allow-Headers', 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With')
14 | ->header('Access-Control-Expose-Headers', 'Authorization')
15 | ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
16 | }
17 | }
--------------------------------------------------------------------------------
/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | check()) {
21 | return redirect('/');
22 | }
23 |
24 | return $next($request);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/Http/Middleware/VerifyCsrfToken.php:
--------------------------------------------------------------------------------
1 | 'required|min:4|max:10|unique:users,username',
11 | 'password' => 'required|min:4|max:10'
12 | ];
13 | }
14 |
15 | public function authorize()
16 | {
17 | return true;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/Http/Requests/Request.php:
--------------------------------------------------------------------------------
1 | 'in:active,pending,inactive,deleted'
13 | ];
14 | }
15 |
16 | public function authorize()
17 | {
18 | return @Auth::user()->role === 'admin';
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/Http/routes.php:
--------------------------------------------------------------------------------
1 | 'api/v1',
5 | 'namespace' => 'Api\v1',
6 | 'middleware' => ['cors']
7 | ], function ($app) {
8 | $app->post('/auth/login', 'AuthController@login');
9 | $app->post('/auth/register', 'AuthController@register');
10 |
11 | $app->post('/auth/facebook', 'AuthController@facebook');
12 | $app->post('/auth/google', 'AuthController@google');
13 | $app->post('/auth/twitter', 'AuthController@twitter');
14 | $app->post('/auth/buffer', 'AuthController@buffer');
15 | });
16 |
17 | Route::group([
18 | 'prefix' => 'api/v1',
19 | 'namespace' => 'Api\v1',
20 | 'middleware' => ['cors', 'jwt.refresh']
21 | ], function ($app) {
22 | $app->get('/auth/refresh', 'AuthController@refresh');
23 | });
24 |
25 | Route::group([
26 | 'prefix' => 'api/v1',
27 | 'namespace' => 'Api\v1',
28 | 'middleware' => ['jwt.auth', 'cors']
29 | ], function ($app) {
30 | $app->post('/auth/logout', 'AuthController@logout');
31 | $app->post('/auth/impersonate', 'AuthController@impersonate');
32 | $app->get('/auth/user', 'AuthController@user');
33 |
34 |
35 | $app->get('/users', 'UserController@all');
36 | });
37 |
38 | Route::options('{any}', ['middleware' => ['cors'], function () { return response(['status' => 'success']); }])->where('any', '.*');
--------------------------------------------------------------------------------
/app/Jobs/Job.php:
--------------------------------------------------------------------------------
1 | 'App\Policies\ModelPolicy',
17 | ];
18 |
19 | /**
20 | * Register any application authentication / authorization services.
21 | *
22 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate
23 | * @return void
24 | */
25 | public function boot(GateContract $gate)
26 | {
27 | $this->registerPolicies($gate);
28 |
29 | //
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
18 | 'App\Listeners\EventListener',
19 | ],
20 | ];
21 |
22 | /**
23 | * Register any other events for your application.
24 | *
25 | * @param \Illuminate\Contracts\Events\Dispatcher $events
26 | * @return void
27 | */
28 | public function boot(DispatcherContract $events)
29 | {
30 | parent::boot($events);
31 |
32 |
33 | // fired when the token could not be found in the request
34 | Event::listen('tymon.jwt.absent', function () {
35 | throw new \App\Exceptions\JWTAbsentException;
36 | });
37 |
38 | // fired when the token has expired
39 | Event::listen('tymon.jwt.expired', function () {
40 | throw new \App\Exceptions\JWTExpiredException;
41 | });
42 |
43 | // fired when the token is found to be invalid
44 | Event::listen('tymon.jwt.invalid', function () {
45 | throw new \App\Exceptions\JWTInvalidException;
46 | });
47 |
48 | // fired if the user could not be found (shouldn't really happen)
49 | Event::listen('tymon.jwt.user_not_found', function () {
50 | throw new \App\Exceptions\JWTUserNotFoundException;
51 | });
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | mapWebRoutes($router);
41 |
42 | //
43 | }
44 |
45 | /**
46 | * Define the "web" routes for the application.
47 | *
48 | * These routes all receive session state, CSRF protection, etc.
49 | *
50 | * @param \Illuminate\Routing\Router $router
51 | * @return void
52 | */
53 | protected function mapWebRoutes(Router $router)
54 | {
55 | $router->group([
56 | 'namespace' => $this->namespace, 'middleware' => 'web',
57 | ], function ($router) {
58 | require app_path('Http/routes.php');
59 | });
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/artisan:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | make(Illuminate\Contracts\Console\Kernel::class);
32 |
33 | $status = $kernel->handle(
34 | $input = new Symfony\Component\Console\Input\ArgvInput,
35 | new Symfony\Component\Console\Output\ConsoleOutput
36 | );
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Shutdown The Application
41 | |--------------------------------------------------------------------------
42 | |
43 | | Once Artisan has finished running. We will fire off the shutdown events
44 | | so that any final work may be done by the application before we shut
45 | | down the process. This is the last thing to happen to the request.
46 | |
47 | */
48 |
49 | $kernel->terminate($input, $status);
50 |
51 | exit($status);
52 |
--------------------------------------------------------------------------------
/bootstrap/app.php:
--------------------------------------------------------------------------------
1 | singleton(
30 | Illuminate\Contracts\Http\Kernel::class,
31 | App\Http\Kernel::class
32 | );
33 |
34 | $app->singleton(
35 | Illuminate\Contracts\Console\Kernel::class,
36 | App\Console\Kernel::class
37 | );
38 |
39 | $app->singleton(
40 | Illuminate\Contracts\Debug\ExceptionHandler::class,
41 | App\Exceptions\Handler::class
42 | );
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Return The Application
47 | |--------------------------------------------------------------------------
48 | |
49 | | This script returns the application instance. The instance is given to
50 | | the calling script so we can separate the building of the instances
51 | | from the actual running of the application and sending responses.
52 | |
53 | */
54 |
55 | return $app;
56 |
--------------------------------------------------------------------------------
/bootstrap/autoload.php:
--------------------------------------------------------------------------------
1 | =5.5.9",
9 | "laravel/framework": "5.2.24",
10 | "tymon/jwt-auth": "0.5.9",
11 | "guzzlehttp/guzzle": "6.1.1",
12 | "laravel/socialite": "2.0.14"
13 | },
14 | "require-dev": {
15 | "fzaninotto/faker": "~1.4",
16 | "mockery/mockery": "0.9.*",
17 | "phpunit/phpunit": "~4.0",
18 | "symfony/css-selector": "2.8.*|3.0.*",
19 | "symfony/dom-crawler": "2.8.*|3.0.*"
20 | },
21 | "autoload": {
22 | "classmap": [
23 | "database"
24 | ],
25 | "psr-4": {
26 | "App\\": "app/"
27 | }
28 | },
29 | "autoload-dev": {
30 | "classmap": [
31 | "tests/TestCase.php"
32 | ]
33 | },
34 | "scripts": {
35 | "post-root-package-install": [
36 | "php -r \"copy('.env.example', '.env');\""
37 | ],
38 | "post-create-project-cmd": [
39 | "php artisan key:generate"
40 | ],
41 | "post-install-cmd": [
42 | "Illuminate\\Foundation\\ComposerScripts::postInstall",
43 | "php artisan optimize"
44 | ],
45 | "post-update-cmd": [
46 | "Illuminate\\Foundation\\ComposerScripts::postUpdate",
47 | "php artisan optimize"
48 | ]
49 | },
50 | "config": {
51 | "preferred-install": "dist"
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/config/app.php:
--------------------------------------------------------------------------------
1 | env('APP_ENV', 'production'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Application Debug Mode
21 | |--------------------------------------------------------------------------
22 | |
23 | | When your application is in debug mode, detailed error messages with
24 | | stack traces will be shown on every error that occurs within your
25 | | application. If disabled, a simple generic error page is shown.
26 | |
27 | */
28 |
29 | 'debug' => env('APP_DEBUG', false),
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Application URL
34 | |--------------------------------------------------------------------------
35 | |
36 | | This URL is used by the console to properly generate URLs when using
37 | | the Artisan command line tool. You should set this to the root of
38 | | your application so that it is used when running Artisan tasks.
39 | |
40 | */
41 |
42 | 'url' => env('APP_URL', 'http://localhost'),
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Application Timezone
47 | |--------------------------------------------------------------------------
48 | |
49 | | Here you may specify the default timezone for your application, which
50 | | will be used by the PHP date and date-time functions. We have gone
51 | | ahead and set this to a sensible default for you out of the box.
52 | |
53 | */
54 |
55 | 'timezone' => 'UTC',
56 |
57 | /*
58 | |--------------------------------------------------------------------------
59 | | Application Locale Configuration
60 | |--------------------------------------------------------------------------
61 | |
62 | | The application locale determines the default locale that will be used
63 | | by the translation service provider. You are free to set this value
64 | | to any of the locales which will be supported by the application.
65 | |
66 | */
67 |
68 | 'locale' => 'en',
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Application Fallback Locale
73 | |--------------------------------------------------------------------------
74 | |
75 | | The fallback locale determines the locale to use when the current one
76 | | is not available. You may change the value to correspond to any of
77 | | the language folders that are provided through your application.
78 | |
79 | */
80 |
81 | 'fallback_locale' => 'en',
82 |
83 | /*
84 | |--------------------------------------------------------------------------
85 | | Encryption Key
86 | |--------------------------------------------------------------------------
87 | |
88 | | This key is used by the Illuminate encrypter service and should be set
89 | | to a random, 32 character string, otherwise these encrypted strings
90 | | will not be safe. Please do this before deploying an application!
91 | |
92 | */
93 |
94 | 'key' => env('APP_KEY'),
95 |
96 | 'cipher' => 'AES-256-CBC',
97 |
98 | /*
99 | |--------------------------------------------------------------------------
100 | | Logging Configuration
101 | |--------------------------------------------------------------------------
102 | |
103 | | Here you may configure the log settings for your application. Out of
104 | | the box, Laravel uses the Monolog PHP logging library. This gives
105 | | you a variety of powerful log handlers / formatters to utilize.
106 | |
107 | | Available Settings: "single", "daily", "syslog", "errorlog"
108 | |
109 | */
110 |
111 | 'log' => env('APP_LOG', 'single'),
112 |
113 | /*
114 | |--------------------------------------------------------------------------
115 | | Autoloaded Service Providers
116 | |--------------------------------------------------------------------------
117 | |
118 | | The service providers listed here will be automatically loaded on the
119 | | request to your application. Feel free to add your own services to
120 | | this array to grant expanded functionality to your applications.
121 | |
122 | */
123 |
124 | 'providers' => [
125 |
126 | /*
127 | * Laravel Framework Service Providers...
128 | */
129 | Illuminate\Auth\AuthServiceProvider::class,
130 | Illuminate\Broadcasting\BroadcastServiceProvider::class,
131 | Illuminate\Bus\BusServiceProvider::class,
132 | Illuminate\Cache\CacheServiceProvider::class,
133 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
134 | Illuminate\Cookie\CookieServiceProvider::class,
135 | Illuminate\Database\DatabaseServiceProvider::class,
136 | Illuminate\Encryption\EncryptionServiceProvider::class,
137 | Illuminate\Filesystem\FilesystemServiceProvider::class,
138 | Illuminate\Foundation\Providers\FoundationServiceProvider::class,
139 | Illuminate\Hashing\HashServiceProvider::class,
140 | Illuminate\Mail\MailServiceProvider::class,
141 | Illuminate\Pagination\PaginationServiceProvider::class,
142 | Illuminate\Pipeline\PipelineServiceProvider::class,
143 | Illuminate\Queue\QueueServiceProvider::class,
144 | Illuminate\Redis\RedisServiceProvider::class,
145 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
146 | Illuminate\Session\SessionServiceProvider::class,
147 | Illuminate\Translation\TranslationServiceProvider::class,
148 | Illuminate\Validation\ValidationServiceProvider::class,
149 | Illuminate\View\ViewServiceProvider::class,
150 |
151 | /*
152 | * Application Service Providers...
153 | */
154 | App\Providers\AppServiceProvider::class,
155 | App\Providers\AuthServiceProvider::class,
156 | App\Providers\EventServiceProvider::class,
157 | App\Providers\RouteServiceProvider::class,
158 |
159 | /*
160 | * Additional Service Providers...
161 | */
162 | Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
163 | Laravel\Socialite\SocialiteServiceProvider::class
164 |
165 | ],
166 |
167 | /*
168 | |--------------------------------------------------------------------------
169 | | Class Aliases
170 | |--------------------------------------------------------------------------
171 | |
172 | | This array of class aliases will be registered when this application
173 | | is started. However, feel free to register as many as you wish as
174 | | the aliases are "lazy" loaded so they don't hinder performance.
175 | |
176 | */
177 |
178 | 'aliases' => [
179 |
180 | 'App' => Illuminate\Support\Facades\App::class,
181 | 'Artisan' => Illuminate\Support\Facades\Artisan::class,
182 | 'Auth' => Illuminate\Support\Facades\Auth::class,
183 | 'Blade' => Illuminate\Support\Facades\Blade::class,
184 | 'Cache' => Illuminate\Support\Facades\Cache::class,
185 | 'Config' => Illuminate\Support\Facades\Config::class,
186 | 'Cookie' => Illuminate\Support\Facades\Cookie::class,
187 | 'Crypt' => Illuminate\Support\Facades\Crypt::class,
188 | 'DB' => Illuminate\Support\Facades\DB::class,
189 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
190 | 'Event' => Illuminate\Support\Facades\Event::class,
191 | 'File' => Illuminate\Support\Facades\File::class,
192 | 'Gate' => Illuminate\Support\Facades\Gate::class,
193 | 'Hash' => Illuminate\Support\Facades\Hash::class,
194 | 'Lang' => Illuminate\Support\Facades\Lang::class,
195 | 'Log' => Illuminate\Support\Facades\Log::class,
196 | 'Mail' => Illuminate\Support\Facades\Mail::class,
197 | 'Password' => Illuminate\Support\Facades\Password::class,
198 | 'Queue' => Illuminate\Support\Facades\Queue::class,
199 | 'Redirect' => Illuminate\Support\Facades\Redirect::class,
200 | 'Redis' => Illuminate\Support\Facades\Redis::class,
201 | 'Request' => Illuminate\Support\Facades\Request::class,
202 | 'Response' => Illuminate\Support\Facades\Response::class,
203 | 'Route' => Illuminate\Support\Facades\Route::class,
204 | 'Schema' => Illuminate\Support\Facades\Schema::class,
205 | 'Session' => Illuminate\Support\Facades\Session::class,
206 | 'Storage' => Illuminate\Support\Facades\Storage::class,
207 | 'URL' => Illuminate\Support\Facades\URL::class,
208 | 'Validator' => Illuminate\Support\Facades\Validator::class,
209 | 'View' => Illuminate\Support\Facades\View::class,
210 |
211 | 'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
212 | 'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
213 | 'Socialite' => Laravel\Socialite\Facades\Socialite::class,
214 |
215 | ],
216 |
217 | ];
218 |
--------------------------------------------------------------------------------
/config/auth.php:
--------------------------------------------------------------------------------
1 | [
17 | 'guard' => 'web',
18 | 'passwords' => 'users',
19 | ],
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Authentication Guards
24 | |--------------------------------------------------------------------------
25 | |
26 | | Next, you may define every authentication guard for your application.
27 | | Of course, a great default configuration has been defined for you
28 | | here which uses session storage and the Eloquent user provider.
29 | |
30 | | All authentication drivers have a user provider. This defines how the
31 | | users are actually retrieved out of your database or other storage
32 | | mechanisms used by this application to persist your user's data.
33 | |
34 | | Supported: "session", "token"
35 | |
36 | */
37 |
38 | 'guards' => [
39 | 'web' => [
40 | 'driver' => 'session',
41 | 'provider' => 'users',
42 | ],
43 |
44 | 'api' => [
45 | 'driver' => 'token',
46 | 'provider' => 'users',
47 | ],
48 | ],
49 |
50 | /*
51 | |--------------------------------------------------------------------------
52 | | User Providers
53 | |--------------------------------------------------------------------------
54 | |
55 | | All authentication drivers have a user provider. This defines how the
56 | | users are actually retrieved out of your database or other storage
57 | | mechanisms used by this application to persist your user's data.
58 | |
59 | | If you have multiple user tables or models you may configure multiple
60 | | sources which represent each model / table. These sources may then
61 | | be assigned to any extra authentication guards you have defined.
62 | |
63 | | Supported: "database", "eloquent"
64 | |
65 | */
66 |
67 | 'providers' => [
68 | 'users' => [
69 | 'driver' => 'eloquent',
70 | 'model' => App\Models\User::class,
71 | ],
72 |
73 | // 'users' => [
74 | // 'driver' => 'database',
75 | // 'table' => 'users',
76 | // ],
77 | ],
78 |
79 | /*
80 | |--------------------------------------------------------------------------
81 | | Resetting Passwords
82 | |--------------------------------------------------------------------------
83 | |
84 | | Here you may set the options for resetting passwords including the view
85 | | that is your password reset e-mail. You may also set the name of the
86 | | table that maintains all of the reset tokens for your application.
87 | |
88 | | You may specify multiple password reset configurations if you have more
89 | | than one user table or model in the application and you want to have
90 | | separate password reset settings based on the specific user types.
91 | |
92 | | The expire time is the number of minutes that the reset token should be
93 | | considered valid. This security feature keeps tokens short-lived so
94 | | they have less time to be guessed. You may change this as needed.
95 | |
96 | */
97 |
98 | 'passwords' => [
99 | 'users' => [
100 | 'provider' => 'users',
101 | 'email' => 'auth.emails.password',
102 | 'table' => 'password_resets',
103 | 'expire' => 60,
104 | ],
105 | ],
106 |
107 | ];
108 |
--------------------------------------------------------------------------------
/config/broadcasting.php:
--------------------------------------------------------------------------------
1 | env('BROADCAST_DRIVER', 'pusher'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Broadcast Connections
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may define all of the broadcast connections that will be used
24 | | to broadcast events to other systems or over websockets. Samples of
25 | | each available type of connection are provided inside this array.
26 | |
27 | */
28 |
29 | 'connections' => [
30 |
31 | 'pusher' => [
32 | 'driver' => 'pusher',
33 | 'key' => env('PUSHER_KEY'),
34 | 'secret' => env('PUSHER_SECRET'),
35 | 'app_id' => env('PUSHER_APP_ID'),
36 | 'options' => [
37 | //
38 | ],
39 | ],
40 |
41 | 'redis' => [
42 | 'driver' => 'redis',
43 | 'connection' => 'default',
44 | ],
45 |
46 | 'log' => [
47 | 'driver' => 'log',
48 | ],
49 |
50 | ],
51 |
52 | ];
53 |
--------------------------------------------------------------------------------
/config/cache.php:
--------------------------------------------------------------------------------
1 | env('CACHE_DRIVER', 'file'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Cache Stores
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may define all of the cache "stores" for your application as
24 | | well as their drivers. You may even define multiple stores for the
25 | | same cache driver to group types of items stored in your caches.
26 | |
27 | */
28 |
29 | 'stores' => [
30 |
31 | 'apc' => [
32 | 'driver' => 'apc',
33 | ],
34 |
35 | 'array' => [
36 | 'driver' => 'array',
37 | ],
38 |
39 | 'database' => [
40 | 'driver' => 'database',
41 | 'table' => 'cache',
42 | 'connection' => null,
43 | ],
44 |
45 | 'file' => [
46 | 'driver' => 'file',
47 | 'path' => storage_path('framework/cache'),
48 | ],
49 |
50 | 'memcached' => [
51 | 'driver' => 'memcached',
52 | 'servers' => [
53 | [
54 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
55 | 'port' => env('MEMCACHED_PORT', 11211),
56 | 'weight' => 100,
57 | ],
58 | ],
59 | ],
60 |
61 | 'redis' => [
62 | 'driver' => 'redis',
63 | 'connection' => 'default',
64 | ],
65 |
66 | ],
67 |
68 | /*
69 | |--------------------------------------------------------------------------
70 | | Cache Key Prefix
71 | |--------------------------------------------------------------------------
72 | |
73 | | When utilizing a RAM based store such as APC or Memcached, there might
74 | | be other applications utilizing the same cache. So, we'll specify a
75 | | value to get prefixed to all our keys so we can avoid collisions.
76 | |
77 | */
78 |
79 | 'prefix' => 'laravel',
80 |
81 | ];
82 |
--------------------------------------------------------------------------------
/config/compile.php:
--------------------------------------------------------------------------------
1 | [
17 | //
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled File Providers
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may list service providers which define a "compiles" function
26 | | that returns additional files that should be compiled, providing an
27 | | easy way to get common files from any packages you are utilizing.
28 | |
29 | */
30 |
31 | 'providers' => [
32 | //
33 | ],
34 |
35 | ];
36 |
--------------------------------------------------------------------------------
/config/database.php:
--------------------------------------------------------------------------------
1 | PDO::FETCH_CLASS,
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Default Database Connection Name
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may specify which of the database connections below you wish
24 | | to use as your default connection for all database work. Of course
25 | | you may use many connections at once using the Database library.
26 | |
27 | */
28 |
29 | 'default' => env('DB_CONNECTION', 'mysql'),
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Database Connections
34 | |--------------------------------------------------------------------------
35 | |
36 | | Here are each of the database connections setup for your application.
37 | | Of course, examples of configuring each database platform that is
38 | | supported by Laravel is shown below to make development simple.
39 | |
40 | |
41 | | All database work in Laravel is done through the PHP PDO facilities
42 | | so make sure you have the driver for your particular database of
43 | | choice installed on your machine before you begin development.
44 | |
45 | */
46 |
47 | 'connections' => [
48 |
49 | 'sqlite' => [
50 | 'driver' => 'sqlite',
51 | 'database' => env('DB_DATABASE', database_path('database.sqlite')),
52 | 'prefix' => '',
53 | ],
54 |
55 | 'mysql' => [
56 | 'driver' => 'mysql',
57 | 'host' => env('DB_HOST', 'localhost'),
58 | 'port' => env('DB_PORT', '3306'),
59 | 'database' => env('DB_DATABASE', 'forge'),
60 | 'username' => env('DB_USERNAME', 'forge'),
61 | 'password' => env('DB_PASSWORD', ''),
62 | 'charset' => 'utf8',
63 | 'collation' => 'utf8_unicode_ci',
64 | 'prefix' => '',
65 | 'strict' => false,
66 | 'engine' => null,
67 | ],
68 |
69 | 'pgsql' => [
70 | 'driver' => 'pgsql',
71 | 'host' => env('DB_HOST', 'localhost'),
72 | 'port' => env('DB_PORT', '5432'),
73 | 'database' => env('DB_DATABASE', 'forge'),
74 | 'username' => env('DB_USERNAME', 'forge'),
75 | 'password' => env('DB_PASSWORD', ''),
76 | 'charset' => 'utf8',
77 | 'prefix' => '',
78 | 'schema' => 'public',
79 | ],
80 |
81 | 'mongodb' => [
82 | 'driver' => 'mongodb',
83 | 'host' => env('MONGO_HOST', 'localhost'),
84 | 'port' => env('MONGO_PORT', 27017),
85 | 'database' => env('MONGO_DATABASE'),
86 | 'username' => env('MONGO_USERNAME'),
87 | 'password' => env('MONGO_PASSWORD'),
88 | 'options' => [
89 | 'db' => 'admin' // sets the authentication database required by mongo 3
90 | ]
91 | ],
92 |
93 | ],
94 |
95 | /*
96 | |--------------------------------------------------------------------------
97 | | Migration Repository Table
98 | |--------------------------------------------------------------------------
99 | |
100 | | This table keeps track of all the migrations that have already run for
101 | | your application. Using this information, we can determine which of
102 | | the migrations on disk haven't actually been run in the database.
103 | |
104 | */
105 |
106 | 'migrations' => 'migrations',
107 |
108 | /*
109 | |--------------------------------------------------------------------------
110 | | Redis Databases
111 | |--------------------------------------------------------------------------
112 | |
113 | | Redis is an open source, fast, and advanced key-value store that also
114 | | provides a richer set of commands than a typical key-value systems
115 | | such as APC or Memcached. Laravel makes it easy to dig right in.
116 | |
117 | */
118 |
119 | 'redis' => [
120 |
121 | 'cluster' => false,
122 |
123 | 'default' => [
124 | 'host' => env('REDIS_HOST', 'localhost'),
125 | 'password' => env('REDIS_PASSWORD', null),
126 | 'port' => env('REDIS_PORT', 6379),
127 | 'database' => 0,
128 | ],
129 |
130 | ],
131 |
132 | ];
133 |
--------------------------------------------------------------------------------
/config/filesystems.php:
--------------------------------------------------------------------------------
1 | 'local',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Default Cloud Filesystem Disk
23 | |--------------------------------------------------------------------------
24 | |
25 | | Many applications store files both locally and in the cloud. For this
26 | | reason, you may specify a default "cloud" driver here. This driver
27 | | will be bound as the Cloud disk implementation in the container.
28 | |
29 | */
30 |
31 | 'cloud' => 's3',
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | Filesystem Disks
36 | |--------------------------------------------------------------------------
37 | |
38 | | Here you may configure as many filesystem "disks" as you wish, and you
39 | | may even configure multiple disks of the same driver. Defaults have
40 | | been setup for each driver as an example of the required options.
41 | |
42 | */
43 |
44 | 'disks' => [
45 |
46 | 'local' => [
47 | 'driver' => 'local',
48 | 'root' => storage_path('app'),
49 | ],
50 |
51 | 'public' => [
52 | 'driver' => 'local',
53 | 'root' => storage_path('app/public'),
54 | 'visibility' => 'public',
55 | ],
56 |
57 | 's3' => [
58 | 'driver' => 's3',
59 | 'key' => 'your-key',
60 | 'secret' => 'your-secret',
61 | 'region' => 'your-region',
62 | 'bucket' => 'your-bucket',
63 | ],
64 |
65 | ],
66 |
67 | ];
68 |
--------------------------------------------------------------------------------
/config/jwt.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | return [
13 |
14 | /*
15 | |--------------------------------------------------------------------------
16 | | JWT Authentication Secret
17 | |--------------------------------------------------------------------------
18 | |
19 | | Don't forget to set this, as it will be used to sign your tokens.
20 | | A helper command is provided for this: `php artisan jwt:generate`
21 | |
22 | */
23 |
24 | 'secret' => env('JWT_SECRET', 'DO6Y2Sxko5kiszdF1pVOaDUEVemGJESU'),
25 |
26 | /*
27 | |--------------------------------------------------------------------------
28 | | JWT time to live
29 | |--------------------------------------------------------------------------
30 | |
31 | | Specify the length of time (in minutes) that the token will be valid for.
32 | | Defaults to 1 hour
33 | |
34 | */
35 |
36 | 'ttl' => 60,
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Refresh time to live
41 | |--------------------------------------------------------------------------
42 | |
43 | | Specify the length of time (in minutes) that the token can be refreshed
44 | | within. I.E. The user can refresh their token within a 2 week window of
45 | | the original token being created until they must re-authenticate.
46 | | Defaults to 2 weeks
47 | |
48 | */
49 |
50 | 'refresh_ttl' => 20160,
51 |
52 | /*
53 | |--------------------------------------------------------------------------
54 | | JWT hashing algorithm
55 | |--------------------------------------------------------------------------
56 | |
57 | | Specify the hashing algorithm that will be used to sign the token.
58 | |
59 | | See here: https://github.com/namshi/jose/tree/2.2.0/src/Namshi/JOSE/Signer
60 | | for possible values
61 | |
62 | */
63 |
64 | 'algo' => 'HS256',
65 |
66 | /*
67 | |--------------------------------------------------------------------------
68 | | User Model namespace
69 | |--------------------------------------------------------------------------
70 | |
71 | | Specify the full namespace to your User model.
72 | | e.g. 'Acme\Entities\User'
73 | |
74 | */
75 |
76 | 'user' => 'App\Models\User',
77 |
78 | /*
79 | |--------------------------------------------------------------------------
80 | | User identifier
81 | |--------------------------------------------------------------------------
82 | |
83 | | Specify a unique property of the user that will be added as the 'sub'
84 | | claim of the token payload.
85 | |
86 | */
87 |
88 | 'identifier' => 'id',
89 |
90 | /*
91 | |--------------------------------------------------------------------------
92 | | Required Claims
93 | |--------------------------------------------------------------------------
94 | |
95 | | Specify the required claims that must exist in any token.
96 | | A TokenInvalidException will be thrown if any of these claims are not
97 | | present in the payload.
98 | |
99 | */
100 |
101 | 'required_claims' => ['iss', 'iat', 'exp', 'nbf', 'sub', 'jti'],
102 |
103 | /*
104 | |--------------------------------------------------------------------------
105 | | Blacklist Enabled
106 | |--------------------------------------------------------------------------
107 | |
108 | | In order to invalidate tokens, you must have the the blacklist enabled.
109 | | If you do not want or need this functionality, then set this to false.
110 | |
111 | */
112 |
113 | 'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
114 |
115 | /*
116 | |--------------------------------------------------------------------------
117 | | Providers
118 | |--------------------------------------------------------------------------
119 | |
120 | | Specify the various providers used throughout the package.
121 | |
122 | */
123 |
124 | 'providers' => [
125 |
126 | /*
127 | |--------------------------------------------------------------------------
128 | | User Provider
129 | |--------------------------------------------------------------------------
130 | |
131 | | Specify the provider that is used to find the user based
132 | | on the subject claim
133 | |
134 | */
135 |
136 | 'user' => 'Tymon\JWTAuth\Providers\User\EloquentUserAdapter',
137 |
138 | /*
139 | |--------------------------------------------------------------------------
140 | | JWT Provider
141 | |--------------------------------------------------------------------------
142 | |
143 | | Specify the provider that is used to create and decode the tokens.
144 | |
145 | */
146 |
147 | 'jwt' => 'Tymon\JWTAuth\Providers\JWT\NamshiAdapter',
148 |
149 | /*
150 | |--------------------------------------------------------------------------
151 | | Authentication Provider
152 | |--------------------------------------------------------------------------
153 | |
154 | | Specify the provider that is used to authenticate users.
155 | |
156 | */
157 |
158 | 'auth' => 'Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter',
159 |
160 | /*
161 | |--------------------------------------------------------------------------
162 | | Storage Provider
163 | |--------------------------------------------------------------------------
164 | |
165 | | Specify the provider that is used to store tokens in the blacklist
166 | |
167 | */
168 |
169 | 'storage' => 'Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter',
170 |
171 | ],
172 |
173 | ];
174 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_DRIVER', 'smtp'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | SMTP Host Address
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may provide the host address of the SMTP server used by your
27 | | applications. A default option is provided that is compatible with
28 | | the Mailgun mail service which will provide reliable deliveries.
29 | |
30 | */
31 |
32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
33 |
34 | /*
35 | |--------------------------------------------------------------------------
36 | | SMTP Host Port
37 | |--------------------------------------------------------------------------
38 | |
39 | | This is the SMTP port used by your application to deliver e-mails to
40 | | users of the application. Like the host we have set this value to
41 | | stay compatible with the Mailgun e-mail application by default.
42 | |
43 | */
44 |
45 | 'port' => env('MAIL_PORT', 587),
46 |
47 | /*
48 | |--------------------------------------------------------------------------
49 | | Global "From" Address
50 | |--------------------------------------------------------------------------
51 | |
52 | | You may wish for all e-mails sent by your application to be sent from
53 | | the same address. Here, you may specify a name and address that is
54 | | used globally for all e-mails that are sent by your application.
55 | |
56 | */
57 |
58 | 'from' => ['address' => null, 'name' => null],
59 |
60 | /*
61 | |--------------------------------------------------------------------------
62 | | E-Mail Encryption Protocol
63 | |--------------------------------------------------------------------------
64 | |
65 | | Here you may specify the encryption protocol that should be used when
66 | | the application send e-mail messages. A sensible default using the
67 | | transport layer security protocol should provide great security.
68 | |
69 | */
70 |
71 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
72 |
73 | /*
74 | |--------------------------------------------------------------------------
75 | | SMTP Server Username
76 | |--------------------------------------------------------------------------
77 | |
78 | | If your SMTP server requires a username for authentication, you should
79 | | set it here. This will get used to authenticate with your server on
80 | | connection. You may also set the "password" value below this one.
81 | |
82 | */
83 |
84 | 'username' => env('MAIL_USERNAME'),
85 |
86 | /*
87 | |--------------------------------------------------------------------------
88 | | SMTP Server Password
89 | |--------------------------------------------------------------------------
90 | |
91 | | Here you may set the password required by your SMTP server to send out
92 | | messages from your application. This will be given to the server on
93 | | connection so that the application will be able to send messages.
94 | |
95 | */
96 |
97 | 'password' => env('MAIL_PASSWORD'),
98 |
99 | /*
100 | |--------------------------------------------------------------------------
101 | | Sendmail System Path
102 | |--------------------------------------------------------------------------
103 | |
104 | | When using the "sendmail" driver to send e-mails, we will need to know
105 | | the path to where Sendmail lives on this server. A default path has
106 | | been provided here, which will work well on most of your systems.
107 | |
108 | */
109 |
110 | 'sendmail' => '/usr/sbin/sendmail -bs',
111 |
112 | ];
113 |
--------------------------------------------------------------------------------
/config/queue.php:
--------------------------------------------------------------------------------
1 | env('QUEUE_DRIVER', 'sync'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Queue Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may configure the connection information for each server that
26 | | is used by your application. A default configuration has been added
27 | | for each back-end shipped with Laravel. You are free to add more.
28 | |
29 | */
30 |
31 | 'connections' => [
32 |
33 | 'sync' => [
34 | 'driver' => 'sync',
35 | ],
36 |
37 | 'database' => [
38 | 'driver' => 'database',
39 | 'table' => 'jobs',
40 | 'queue' => 'default',
41 | 'expire' => 60,
42 | ],
43 |
44 | 'beanstalkd' => [
45 | 'driver' => 'beanstalkd',
46 | 'host' => 'localhost',
47 | 'queue' => 'default',
48 | 'ttr' => 60,
49 | ],
50 |
51 | 'sqs' => [
52 | 'driver' => 'sqs',
53 | 'key' => 'your-public-key',
54 | 'secret' => 'your-secret-key',
55 | 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
56 | 'queue' => 'your-queue-name',
57 | 'region' => 'us-east-1',
58 | ],
59 |
60 | 'redis' => [
61 | 'driver' => 'redis',
62 | 'connection' => 'default',
63 | 'queue' => 'default',
64 | 'expire' => 60,
65 | ],
66 |
67 | ],
68 |
69 | /*
70 | |--------------------------------------------------------------------------
71 | | Failed Queue Jobs
72 | |--------------------------------------------------------------------------
73 | |
74 | | These options configure the behavior of failed queue job logging so you
75 | | can control which database and table are used to store the jobs that
76 | | have failed. You may change them to any database / table you wish.
77 | |
78 | */
79 |
80 | 'failed' => [
81 | 'database' => env('DB_CONNECTION', 'mysql'),
82 | 'table' => 'failed_jobs',
83 | ],
84 |
85 | ];
86 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | ],
21 |
22 | 'ses' => [
23 | 'key' => env('SES_KEY'),
24 | 'secret' => env('SES_SECRET'),
25 | 'region' => 'us-east-1',
26 | ],
27 |
28 | 'sparkpost' => [
29 | 'secret' => env('SPARKPOST_SECRET'),
30 | ],
31 |
32 | 'stripe' => [
33 | 'model' => App\User::class,
34 | 'key' => env('STRIPE_KEY'),
35 | 'secret' => env('STRIPE_SECRET'),
36 | ],
37 |
38 | 'facebook' => [
39 | 'client_id' => getenv('FACEBOOK_CLIENT_ID'),
40 | 'client_secret' => getenv('FACEBOOK_CLIENT_SECRET'),
41 | 'redirect' => getenv('FACEBOOK_REDIRECT_URL'),
42 | ],
43 |
44 | 'google' => [
45 | 'client_id' => getenv('GOOGLE_CLIENT_ID'),
46 | 'client_secret' => getenv('GOOGLE_CLIENT_SECRET'),
47 | 'redirect' => getenv('GOOGLE_REDIRECT_URL'),
48 | ],
49 |
50 | 'twitter' => [
51 | 'client_id' => getenv('TWITTER_CLIENT_ID'),
52 | 'client_secret' => getenv('TWITTER_CLIENT_SECRET'),
53 | 'redirect' => getenv('TWITTER_REDIRECT_URL'),
54 | ],
55 |
56 | 'github' => [
57 | 'client_id' => getenv('GITHUB_CLIENT_ID'),
58 | 'client_secret' => getenv('GITHUB_CLIENT_SECRET'),
59 | 'redirect' => getenv('GITHUB_REDIRECT_URL'),
60 | ],
61 |
62 | ];
63 |
--------------------------------------------------------------------------------
/config/session.php:
--------------------------------------------------------------------------------
1 | env('SESSION_DRIVER', 'file'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Session Lifetime
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may specify the number of minutes that you wish the session
27 | | to be allowed to remain idle before it expires. If you want them
28 | | to immediately expire on the browser closing, set that option.
29 | |
30 | */
31 |
32 | 'lifetime' => 120,
33 |
34 | 'expire_on_close' => false,
35 |
36 | /*
37 | |--------------------------------------------------------------------------
38 | | Session Encryption
39 | |--------------------------------------------------------------------------
40 | |
41 | | This option allows you to easily specify that all of your session data
42 | | should be encrypted before it is stored. All encryption will be run
43 | | automatically by Laravel and you can use the Session like normal.
44 | |
45 | */
46 |
47 | 'encrypt' => false,
48 |
49 | /*
50 | |--------------------------------------------------------------------------
51 | | Session File Location
52 | |--------------------------------------------------------------------------
53 | |
54 | | When using the native session driver, we need a location where session
55 | | files may be stored. A default has been set for you but a different
56 | | location may be specified. This is only needed for file sessions.
57 | |
58 | */
59 |
60 | 'files' => storage_path('framework/sessions'),
61 |
62 | /*
63 | |--------------------------------------------------------------------------
64 | | Session Database Connection
65 | |--------------------------------------------------------------------------
66 | |
67 | | When using the "database" or "redis" session drivers, you may specify a
68 | | connection that should be used to manage these sessions. This should
69 | | correspond to a connection in your database configuration options.
70 | |
71 | */
72 |
73 | 'connection' => null,
74 |
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Session Database Table
78 | |--------------------------------------------------------------------------
79 | |
80 | | When using the "database" session driver, you may specify the table we
81 | | should use to manage the sessions. Of course, a sensible default is
82 | | provided for you; however, you are free to change this as needed.
83 | |
84 | */
85 |
86 | 'table' => 'sessions',
87 |
88 | /*
89 | |--------------------------------------------------------------------------
90 | | Session Sweeping Lottery
91 | |--------------------------------------------------------------------------
92 | |
93 | | Some session drivers must manually sweep their storage location to get
94 | | rid of old sessions from storage. Here are the chances that it will
95 | | happen on a given request. By default, the odds are 2 out of 100.
96 | |
97 | */
98 |
99 | 'lottery' => [2, 100],
100 |
101 | /*
102 | |--------------------------------------------------------------------------
103 | | Session Cookie Name
104 | |--------------------------------------------------------------------------
105 | |
106 | | Here you may change the name of the cookie used to identify a session
107 | | instance by ID. The name specified here will get used every time a
108 | | new session cookie is created by the framework for every driver.
109 | |
110 | */
111 |
112 | 'cookie' => 'laravel_session',
113 |
114 | /*
115 | |--------------------------------------------------------------------------
116 | | Session Cookie Path
117 | |--------------------------------------------------------------------------
118 | |
119 | | The session cookie path determines the path for which the cookie will
120 | | be regarded as available. Typically, this will be the root path of
121 | | your application but you are free to change this when necessary.
122 | |
123 | */
124 |
125 | 'path' => '/',
126 |
127 | /*
128 | |--------------------------------------------------------------------------
129 | | Session Cookie Domain
130 | |--------------------------------------------------------------------------
131 | |
132 | | Here you may change the domain of the cookie used to identify a session
133 | | in your application. This will determine which domains the cookie is
134 | | available to in your application. A sensible default has been set.
135 | |
136 | */
137 |
138 | 'domain' => null,
139 |
140 | /*
141 | |--------------------------------------------------------------------------
142 | | HTTPS Only Cookies
143 | |--------------------------------------------------------------------------
144 | |
145 | | By setting this option to true, session cookies will only be sent back
146 | | to the server if the browser has a HTTPS connection. This will keep
147 | | the cookie from being sent to you if it can not be done securely.
148 | |
149 | */
150 |
151 | 'secure' => false,
152 |
153 | /*
154 | |--------------------------------------------------------------------------
155 | | HTTP Access Only
156 | |--------------------------------------------------------------------------
157 | |
158 | | Setting this value to true will prevent JavaScript from accessing the
159 | | value of the cookie and the cookie will only be accessible through
160 | | the HTTP protocol. You are free to modify this option if needed.
161 | |
162 | */
163 |
164 | 'http_only' => true,
165 |
166 | ];
167 |
--------------------------------------------------------------------------------
/config/view.php:
--------------------------------------------------------------------------------
1 | [
17 | realpath(base_path('resources/views')),
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled View Path
23 | |--------------------------------------------------------------------------
24 | |
25 | | This option determines where all the compiled Blade templates will be
26 | | stored for your application. Typically, this is within the storage
27 | | directory. However, as usual, you are free to change this value.
28 | |
29 | */
30 |
31 | 'compiled' => realpath(storage_path('framework/views')),
32 |
33 | ];
34 |
--------------------------------------------------------------------------------
/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite
2 |
--------------------------------------------------------------------------------
/database/factories/ModelFactory.php:
--------------------------------------------------------------------------------
1 | define(App\User::class, function (Faker\Generator $faker) {
15 | return [
16 | 'name' => $faker->name,
17 | 'email' => $faker->safeEmail,
18 | 'password' => bcrypt(str_random(10)),
19 | 'remember_token' => str_random(10),
20 | ];
21 | });
22 |
--------------------------------------------------------------------------------
/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | increments('id')->unsigned();
19 | $t->string('username', 255)->nullable()->unique();
20 | $t->string('password', 127);
21 | $t->enum('role', ['user', 'admin'])->index();
22 | $t->timestamps();
23 | });
24 |
25 | $user = new User;
26 | $user->username = 'admin';
27 | $user->password = \Hash::make('secret');
28 | $user->role = 'admin';
29 | $user->save();
30 |
31 | $user = new User;
32 | $user->username = 'social';
33 | $user->password = \Hash::make('secret');
34 | $user->role = 'user';
35 | $user->save();
36 |
37 | $user = new User;
38 | $user->username = 'test';
39 | $user->password = \Hash::make('secret');
40 | $user->role = 'user';
41 | $user->save();
42 | }
43 |
44 | /**
45 | * Reverse the migrations.
46 | *
47 | * @return void
48 | */
49 | public function down()
50 | {
51 | Schema::drop('users');
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/database/seeds/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | call(UsersTableSeeder::class);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | var elixir = require('laravel-elixir');
2 |
3 | /*
4 | |--------------------------------------------------------------------------
5 | | Elixir Asset Management
6 | |--------------------------------------------------------------------------
7 | |
8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks
9 | | for your Laravel application. By default, we are compiling the Sass
10 | | file for our application, as well as publishing vendor resources.
11 | |
12 | */
13 |
14 | elixir(function(mix) {
15 | mix.sass('app.scss');
16 | });
17 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "scripts": {
4 | "prod": "gulp --production",
5 | "dev": "gulp watch"
6 | },
7 | "devDependencies": {
8 | "gulp": "^3.9.1",
9 | "laravel-elixir": "^5.0.0",
10 | "bootstrap-sass": "^3.0.0"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |