├── .env.example
├── .gitattributes
├── .gitignore
├── app
├── Api
│ └── V1
│ │ └── Controllers
│ │ ├── AuthController.php
│ │ └── BookController.php
├── Book.php
├── Console
│ ├── Commands
│ │ └── Inspire.php
│ └── Kernel.php
├── Events
│ └── Event.php
├── Exceptions
│ └── Handler.php
├── Http
│ ├── Controllers
│ │ └── Controller.php
│ ├── Kernel.php
│ ├── Middleware
│ │ ├── Authenticate.php
│ │ ├── EncryptCookies.php
│ │ ├── RedirectIfAuthenticated.php
│ │ └── VerifyCsrfToken.php
│ ├── Requests
│ │ └── Request.php
│ ├── api_routes.php
│ └── routes.php
├── Jobs
│ └── Job.php
├── Listeners
│ └── .gitkeep
├── Policies
│ └── .gitkeep
├── Providers
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
└── User.php
├── artisan
├── bootstrap
├── app.php
├── autoload.php
└── cache
│ └── .gitignore
├── composer.json
├── config
├── api.php
├── app.php
├── auth.php
├── boilerplate.php
├── broadcasting.php
├── cache.php
├── compile.php
├── cors.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
│ ├── 2014_10_12_100000_create_password_resets_table.php
│ └── 2015_09_24_083259_create_books_table.php
└── seeds
│ ├── .gitkeep
│ └── DatabaseSeeder.php
├── gulpfile.js
├── package.json
├── phpspec.yml
├── phpunit.xml
├── public
├── .gitignore
├── .htaccess
├── bower.json
├── favicon.ico
├── index.php
├── js
│ ├── app.js
│ ├── controllers.js
│ └── services.js
├── partials
│ ├── index.html
│ ├── login.html
│ └── signup.html
└── robots.txt
├── readme.md
├── resources
├── assets
│ └── sass
│ │ └── app.scss
├── lang
│ └── en
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
└── views
│ ├── emails
│ └── password.blade.php
│ ├── errors
│ └── 503.blade.php
│ ├── index.blade.php
│ └── vendor
│ └── .gitkeep
├── server.php
├── storage
├── app
│ └── .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 |
5 | DB_HOST=localhost
6 | DB_DATABASE=homestead
7 | DB_USERNAME=homestead
8 | DB_PASSWORD=secret
9 |
10 | CACHE_DRIVER=file
11 | SESSION_DRIVER=file
12 | QUEUE_DRIVER=sync
13 |
14 | MAIL_DRIVER=smtp
15 | MAIL_HOST=mailtrap.io
16 | MAIL_PORT=2525
17 | MAIL_USERNAME=null
18 | MAIL_PASSWORD=null
19 | MAIL_ENCRYPTION=null
20 |
21 | API_PREFIX=api
22 | API_VERSION=v1
23 | API_STRICT=false
24 | API_DEBUG=false
25 |
26 | API_SIGNUP_TOKEN_RELEASE=true
27 | API_RESET_TOKEN_RELEASE=true
28 | API_RECOVERY_EMAIL_SUBJECT=example@domain.com
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.less linguist-vendored
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /.idea
2 | /vendor
3 | /node_modules
4 | Homestead.yaml
5 | Homestead.json
6 | .env
7 | composer.lock
8 |
--------------------------------------------------------------------------------
/app/Api/V1/Controllers/AuthController.php:
--------------------------------------------------------------------------------
1 | only(['email', 'password']);
24 |
25 | $validator = Validator::make($credentials, [
26 | 'email' => 'required',
27 | 'password' => 'required',
28 | ]);
29 |
30 | if($validator->fails()) {
31 | throw new ValidationHttpException($validator->errors()->all());
32 | }
33 |
34 | try {
35 | if (! $token = JWTAuth::attempt($credentials)) {
36 | return $this->response->errorUnauthorized();
37 | }
38 | } catch (JWTException $e) {
39 | return $this->response->error('could_not_create_token', 500);
40 | }
41 |
42 | return response()->json(compact('token'));
43 | }
44 |
45 | public function signup(Request $request)
46 | {
47 | $signupFields = Config::get('boilerplate.signup_fields');
48 | $hasToReleaseToken = Config::get('boilerplate.signup_token_release');
49 |
50 | $userData = $request->only($signupFields);
51 |
52 | $validator = Validator::make($userData, Config::get('boilerplate.signup_fields_rules'));
53 |
54 | if($validator->fails()) {
55 | throw new ValidationHttpException($validator->errors()->all());
56 | }
57 |
58 | User::unguard();
59 | $user = User::create($userData);
60 | User::reguard();
61 |
62 | if(!$user->id) {
63 | return $this->response->error('could_not_create_user', 500);
64 | }
65 |
66 | if($hasToReleaseToken) {
67 | return $this->login($request);
68 | }
69 |
70 | return $this->response->created();
71 | }
72 |
73 | public function recovery(Request $request)
74 | {
75 | $validator = Validator::make($request->only('email'), [
76 | 'email' => 'required'
77 | ]);
78 |
79 | if($validator->fails()) {
80 | throw new ValidationHttpException($validator->errors()->all());
81 | }
82 |
83 | $response = Password::sendResetLink($request->only('email'), function (Message $message) {
84 | $message->subject(Config::get('boilerplate.recovery_email_subject'));
85 | });
86 |
87 | switch ($response) {
88 | case Password::RESET_LINK_SENT:
89 | return $this->response->noContent();
90 | case Password::INVALID_USER:
91 | return $this->response->errorNotFound();
92 | }
93 | }
94 |
95 | public function reset(Request $request)
96 | {
97 | $credentials = $request->only(
98 | 'email', 'password', 'password_confirmation', 'token'
99 | );
100 |
101 | $validator = Validator::make($credentials, [
102 | 'token' => 'required',
103 | 'email' => 'required|email',
104 | 'password' => 'required|confirmed|min:6',
105 | ]);
106 |
107 | if($validator->fails()) {
108 | throw new ValidationHttpException($validator->errors()->all());
109 | }
110 |
111 | $response = Password::reset($credentials, function ($user, $password) {
112 | $user->password = $password;
113 | $user->save();
114 | });
115 |
116 | switch ($response) {
117 | case Password::PASSWORD_RESET:
118 | if(Config::get('boilerplate.reset_token_release')) {
119 | return $this->login($request);
120 | }
121 | return $this->response->noContent();
122 |
123 | default:
124 | return $this->response->error('could_not_reset_password', 500);
125 | }
126 | }
127 | }
--------------------------------------------------------------------------------
/app/Api/V1/Controllers/BookController.php:
--------------------------------------------------------------------------------
1 | currentUser()
20 | ->books()
21 | ->orderBy('created_at', 'DESC')
22 | ->get()
23 | ->toArray();
24 | }
25 |
26 | public function show($id)
27 | {
28 | $book = $this->currentUser()->books()->find($id);
29 |
30 | if(!$book)
31 | throw new NotFoundHttpException;
32 |
33 | return $book;
34 | }
35 |
36 | public function store(Request $request)
37 | {
38 | $book = new Book;
39 |
40 | $book->title = $request->get('title');
41 | $book->author_name = $request->get('author_name');
42 | $book->pages_count = $request->get('pages_count');
43 |
44 | if($this->currentUser()->books()->save($book))
45 | return $this->response->created();
46 | else
47 | return $this->response->error('could_not_create_book', 500);
48 | }
49 |
50 | public function update(Request $request, $id)
51 | {
52 | $book = $this->currentUser()->books()->find($id);
53 | if(!$book)
54 | throw new NotFoundHttpException;
55 |
56 | $book->fill($request->all());
57 |
58 | if($book->save())
59 | return $this->response->noContent();
60 | else
61 | return $this->response->error('could_not_update_book', 500);
62 | }
63 |
64 | public function destroy($id)
65 | {
66 | $book = $this->currentUser()->books()->find($id);
67 |
68 | if(!$book)
69 | throw new NotFoundHttpException;
70 |
71 | if($book->delete())
72 | return $this->response->noContent();
73 | else
74 | return $this->response->error('could_not_delete_book', 500);
75 | }
76 |
77 | private function currentUser() {
78 | return JWTAuth::parseToken()->authenticate();
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/app/Book.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 | getMessage(), $e);
47 | }
48 |
49 | return parent::render($request, $e);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | \App\Http\Middleware\VerifyCsrfToken::class,
29 | 'auth' => \App\Http\Middleware\Authenticate::class,
30 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
31 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
32 | 'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class
33 | ];
34 | }
35 |
--------------------------------------------------------------------------------
/app/Http/Middleware/Authenticate.php:
--------------------------------------------------------------------------------
1 | auth = $auth;
26 | }
27 |
28 | /**
29 | * Handle an incoming request.
30 | *
31 | * @param \Illuminate\Http\Request $request
32 | * @param \Closure $next
33 | * @return mixed
34 | */
35 | public function handle($request, Closure $next)
36 | {
37 | if ($this->auth->guest()) {
38 | if ($request->ajax()) {
39 | return response('Unauthorized.', 401);
40 | } else {
41 | return redirect()->guest('auth/login');
42 | }
43 | }
44 |
45 | return $next($request);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | auth = $auth;
26 | }
27 |
28 | /**
29 | * Handle an incoming request.
30 | *
31 | * @param \Illuminate\Http\Request $request
32 | * @param \Closure $next
33 | * @return mixed
34 | */
35 | public function handle($request, Closure $next)
36 | {
37 | if ($this->auth->check()) {
38 | return redirect('/home');
39 | }
40 |
41 | return $next($request);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/Http/Middleware/VerifyCsrfToken.php:
--------------------------------------------------------------------------------
1 | version('v1', function ($api) {
6 |
7 | $api->post('auth/login', 'App\Api\V1\Controllers\AuthController@login');
8 | $api->post('auth/signup', 'App\Api\V1\Controllers\AuthController@signup');
9 | $api->post('auth/recovery', 'App\Api\V1\Controllers\AuthController@recovery');
10 | $api->post('auth/reset', 'App\Api\V1\Controllers\AuthController@reset');
11 |
12 | $api->group(['middleware' => 'api.auth'], function ($api) {
13 | $api->resource('books', 'App\Api\V1\Controllers\BookController');
14 | });
15 |
16 | });
--------------------------------------------------------------------------------
/app/Http/routes.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 | parent::registerPolicies($gate);
28 |
29 | //
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
17 | 'App\Listeners\EventListener',
18 | ],
19 | ];
20 |
21 | /**
22 | * Register any other events for your application.
23 | *
24 | * @param \Illuminate\Contracts\Events\Dispatcher $events
25 | * @return void
26 | */
27 | public function boot(DispatcherContract $events)
28 | {
29 | parent::boot($events);
30 |
31 | //
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | group(['namespace' => $this->namespace], function ($router) {
41 | require app_path('Http/api_routes.php');
42 | require app_path('Http/routes.php');
43 | });
44 | }
45 | }
--------------------------------------------------------------------------------
/app/User.php:
--------------------------------------------------------------------------------
1 | attributes['password'] = \Hash::make($value);
48 | }
49 |
50 | public function books()
51 | {
52 | return $this->hasMany('App\Book');
53 | }
54 | }
--------------------------------------------------------------------------------
/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.1.*",
10 | "tymon/jwt-auth": "0.5.*",
11 | "dingo/api": "1.0.*@dev",
12 | "barryvdh/laravel-cors": "^0.7.1"
13 | },
14 | "require-dev": {
15 | "fzaninotto/faker": "~1.4",
16 | "mockery/mockery": "0.9.*",
17 | "phpunit/phpunit": "~4.0",
18 | "phpspec/phpspec": "~2.1"
19 | },
20 | "autoload": {
21 | "classmap": [
22 | "database"
23 | ],
24 | "psr-4": {
25 | "App\\": "app/"
26 | }
27 | },
28 | "autoload-dev": {
29 | "classmap": [
30 | "tests/TestCase.php"
31 | ]
32 | },
33 | "scripts": {
34 | "post-install-cmd": [
35 | "php artisan clear-compiled",
36 | "php artisan optimize",
37 | "php -r \"copy('.env.example', '.env');\"",
38 | "php artisan key:generate",
39 | "php artisan jwt:generate"
40 | ],
41 | "pre-update-cmd": [
42 | "php artisan clear-compiled"
43 | ],
44 | "post-update-cmd": [
45 | "php artisan optimize"
46 | ]
47 | },
48 | "config": {
49 | "preferred-install": "dist"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/config/api.php:
--------------------------------------------------------------------------------
1 | env('API_STANDARDS_TREE', 'x'),
22 |
23 | /*
24 | |--------------------------------------------------------------------------
25 | | API Subtype
26 | |--------------------------------------------------------------------------
27 | |
28 | | Your subtype will follow the standards tree you use when used in the
29 | | "Accept" header to negotiate the content type and version.
30 | |
31 | | For example: Accept: application/x.SUBTYPE.v1+json
32 | |
33 | */
34 |
35 | 'subtype' => env('API_SUBTYPE', ''),
36 |
37 | /*
38 | |--------------------------------------------------------------------------
39 | | Default API Version
40 | |--------------------------------------------------------------------------
41 | |
42 | | This is the default version when strict mode is disabled and your API
43 | | is accessed via a web browser. It's also used as the default version
44 | | when generating your APIs documentation.
45 | |
46 | */
47 |
48 | 'version' => env('API_VERSION', 'v1'),
49 |
50 | /*
51 | |--------------------------------------------------------------------------
52 | | Default API Prefix
53 | |--------------------------------------------------------------------------
54 | |
55 | | A default prefix to use for your API routes so you don't have to
56 | | specify it for each group.
57 | |
58 | */
59 |
60 | 'prefix' => env('API_PREFIX', null),
61 |
62 | /*
63 | |--------------------------------------------------------------------------
64 | | Default API Domain
65 | |--------------------------------------------------------------------------
66 | |
67 | | A default domain to use for your API routes so you don't have to
68 | | specify it for each group.
69 | |
70 | */
71 |
72 | 'domain' => env('API_DOMAIN', null),
73 |
74 | /*
75 | |--------------------------------------------------------------------------
76 | | Name
77 | |--------------------------------------------------------------------------
78 | |
79 | | When documenting your API using the API Blueprint syntax you can
80 | | configure a default name to avoid having to manually specify
81 | | one when using the command.
82 | |
83 | */
84 |
85 | 'name' => env('API_NAME', null),
86 |
87 | /*
88 | |--------------------------------------------------------------------------
89 | | Conditional Requests
90 | |--------------------------------------------------------------------------
91 | |
92 | | Globally enable conditional requests so that an ETag header is added to
93 | | any successful response. Subsequent requests will perform a check and
94 | | will return a 304 Not Modified. This can also be enabled or disabled
95 | | on certain groups or routes.
96 | |
97 | */
98 |
99 | 'conditionalRequest' => env('API_CONDITIONAL_REQUEST', true),
100 |
101 | /*
102 | |--------------------------------------------------------------------------
103 | | Strict Mode
104 | |--------------------------------------------------------------------------
105 | |
106 | | Enabling strict mode will require clients to send a valid Accept header
107 | | with every request. This also voids the default API version, meaning
108 | | your API will not be browsable via a web browser.
109 | |
110 | */
111 |
112 | 'strict' => env('API_STRICT', false),
113 |
114 | /*
115 | |--------------------------------------------------------------------------
116 | | Debug Mode
117 | |--------------------------------------------------------------------------
118 | |
119 | | Enabling debug mode will result in error responses caused by thrown
120 | | exceptions to have a "debug" key that will be populated with
121 | | more detailed information on the exception.
122 | |
123 | */
124 |
125 | 'debug' => env('API_DEBUG', false),
126 |
127 | /*
128 | |--------------------------------------------------------------------------
129 | | Generic Error Format
130 | |--------------------------------------------------------------------------
131 | |
132 | | When some HTTP exceptions are not caught and dealt with the API will
133 | | generate a generic error response in the format provided. Any
134 | | keys that aren't replaced with corresponding values will be
135 | | removed from the final response.
136 | |
137 | */
138 | 'errorFormat' => [
139 | 'error' => [
140 | 'message' => ':message',
141 | 'errors' => ':errors',
142 | 'code' => ':code',
143 | 'status_code' => ':status_code',
144 | 'debug' => ':debug'
145 | ]
146 | ],
147 |
148 | /*
149 | |--------------------------------------------------------------------------
150 | | Authentication Providers
151 | |--------------------------------------------------------------------------
152 | |
153 | | The authentication providers that should be used when attempting to
154 | | authenticate an incoming API request.
155 | |
156 | */
157 |
158 | 'auth' => [
159 | 'jwt' => 'Dingo\Api\Auth\Provider\JWT'
160 | ],
161 |
162 | /*
163 | |--------------------------------------------------------------------------
164 | | Throttling / Rate Limiting
165 | |--------------------------------------------------------------------------
166 | |
167 | | Consumers of your API can be limited to the amount of requests they can
168 | | make. You can create your own throttles or simply change the default
169 | | throttles.
170 | |
171 | */
172 |
173 | 'throttling' => [
174 |
175 | ],
176 |
177 | /*
178 | |--------------------------------------------------------------------------
179 | | Response Transformer
180 | |--------------------------------------------------------------------------
181 | |
182 | | Responses can be transformed so that they are easier to format. By
183 | | default a Fractal transformer will be used to transform any
184 | | responses prior to formatting. You can easily replace
185 | | this with your own transformer.
186 | |
187 | */
188 |
189 | 'transformer' => env('API_TRANSFORMER', 'Dingo\Api\Transformer\Adapter\Fractal'),
190 |
191 | /*
192 | |--------------------------------------------------------------------------
193 | | Response Formats
194 | |--------------------------------------------------------------------------
195 | |
196 | | Responses can be returned in multiple formats by registering different
197 | | response formatters. You can also customize an existing response
198 | | formatter.
199 | |
200 | */
201 |
202 | 'defaultFormat' => env('API_DEFAULT_FORMAT', 'json'),
203 |
204 | 'formats' => [
205 |
206 | 'json' => 'Dingo\Api\Http\Response\Format\Json',
207 |
208 | ],
209 |
210 | ];
211 |
--------------------------------------------------------------------------------
/config/app.php:
--------------------------------------------------------------------------------
1 | env('APP_DEBUG', false),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Application URL
21 | |--------------------------------------------------------------------------
22 | |
23 | | This URL is used by the console to properly generate URLs when using
24 | | the Artisan command line tool. You should set this to the root of
25 | | your application so that it is used when running Artisan tasks.
26 | |
27 | */
28 |
29 | 'url' => 'http://localhost',
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Application Timezone
34 | |--------------------------------------------------------------------------
35 | |
36 | | Here you may specify the default timezone for your application, which
37 | | will be used by the PHP date and date-time functions. We have gone
38 | | ahead and set this to a sensible default for you out of the box.
39 | |
40 | */
41 |
42 | 'timezone' => 'UTC',
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Application Locale Configuration
47 | |--------------------------------------------------------------------------
48 | |
49 | | The application locale determines the default locale that will be used
50 | | by the translation service provider. You are free to set this value
51 | | to any of the locales which will be supported by the application.
52 | |
53 | */
54 |
55 | 'locale' => 'en',
56 |
57 | /*
58 | |--------------------------------------------------------------------------
59 | | Application Fallback Locale
60 | |--------------------------------------------------------------------------
61 | |
62 | | The fallback locale determines the locale to use when the current one
63 | | is not available. You may change the value to correspond to any of
64 | | the language folders that are provided through your application.
65 | |
66 | */
67 |
68 | 'fallback_locale' => 'en',
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Encryption Key
73 | |--------------------------------------------------------------------------
74 | |
75 | | This key is used by the Illuminate encrypter service and should be set
76 | | to a random, 32 character string, otherwise these encrypted strings
77 | | will not be safe. Please do this before deploying an application!
78 | |
79 | */
80 |
81 | 'key' => env('APP_KEY', 'SomeRandomString'),
82 |
83 | 'cipher' => 'AES-256-CBC',
84 |
85 | /*
86 | |--------------------------------------------------------------------------
87 | | Logging Configuration
88 | |--------------------------------------------------------------------------
89 | |
90 | | Here you may configure the log settings for your application. Out of
91 | | the box, Laravel uses the Monolog PHP logging library. This gives
92 | | you a variety of powerful log handlers / formatters to utilize.
93 | |
94 | | Available Settings: "single", "daily", "syslog", "errorlog"
95 | |
96 | */
97 |
98 | 'log' => 'single',
99 |
100 | /*
101 | |--------------------------------------------------------------------------
102 | | Autoloaded Service Providers
103 | |--------------------------------------------------------------------------
104 | |
105 | | The service providers listed here will be automatically loaded on the
106 | | request to your application. Feel free to add your own services to
107 | | this array to grant expanded functionality to your applications.
108 | |
109 | */
110 |
111 | 'providers' => [
112 |
113 | /*
114 | * Laravel Framework Service Providers...
115 | */
116 | Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
117 | Illuminate\Auth\AuthServiceProvider::class,
118 | Illuminate\Broadcasting\BroadcastServiceProvider::class,
119 | Illuminate\Bus\BusServiceProvider::class,
120 | Illuminate\Cache\CacheServiceProvider::class,
121 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
122 | Illuminate\Routing\ControllerServiceProvider::class,
123 | Illuminate\Cookie\CookieServiceProvider::class,
124 | Illuminate\Database\DatabaseServiceProvider::class,
125 | Illuminate\Encryption\EncryptionServiceProvider::class,
126 | Illuminate\Filesystem\FilesystemServiceProvider::class,
127 | Illuminate\Foundation\Providers\FoundationServiceProvider::class,
128 | Illuminate\Hashing\HashServiceProvider::class,
129 | Illuminate\Mail\MailServiceProvider::class,
130 | Illuminate\Pagination\PaginationServiceProvider::class,
131 | Illuminate\Pipeline\PipelineServiceProvider::class,
132 | Illuminate\Queue\QueueServiceProvider::class,
133 | Illuminate\Redis\RedisServiceProvider::class,
134 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
135 | Illuminate\Session\SessionServiceProvider::class,
136 | Illuminate\Translation\TranslationServiceProvider::class,
137 | Illuminate\Validation\ValidationServiceProvider::class,
138 | Illuminate\View\ViewServiceProvider::class,
139 |
140 | /*
141 | * Third Party Providers...
142 | */
143 | Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
144 | Dingo\Api\Provider\LaravelServiceProvider::class,
145 | Barryvdh\Cors\ServiceProvider::class,
146 |
147 | /*
148 | * Application Service Providers...
149 | */
150 | App\Providers\AppServiceProvider::class,
151 | App\Providers\AuthServiceProvider::class,
152 | App\Providers\EventServiceProvider::class,
153 | App\Providers\RouteServiceProvider::class
154 | ],
155 |
156 | /*
157 | |--------------------------------------------------------------------------
158 | | Class Aliases
159 | |--------------------------------------------------------------------------
160 | |
161 | | This array of class aliases will be registered when this application
162 | | is started. However, feel free to register as many as you wish as
163 | | the aliases are "lazy" loaded so they don't hinder performance.
164 | |
165 | */
166 |
167 | 'aliases' => [
168 |
169 | 'App' => Illuminate\Support\Facades\App::class,
170 | 'Artisan' => Illuminate\Support\Facades\Artisan::class,
171 | 'Auth' => Illuminate\Support\Facades\Auth::class,
172 | 'Blade' => Illuminate\Support\Facades\Blade::class,
173 | 'Bus' => Illuminate\Support\Facades\Bus::class,
174 | 'Cache' => Illuminate\Support\Facades\Cache::class,
175 | 'Config' => Illuminate\Support\Facades\Config::class,
176 | 'Cookie' => Illuminate\Support\Facades\Cookie::class,
177 | 'Crypt' => Illuminate\Support\Facades\Crypt::class,
178 | 'DB' => Illuminate\Support\Facades\DB::class,
179 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
180 | 'Event' => Illuminate\Support\Facades\Event::class,
181 | 'File' => Illuminate\Support\Facades\File::class,
182 | 'Gate' => Illuminate\Support\Facades\Gate::class,
183 | 'Hash' => Illuminate\Support\Facades\Hash::class,
184 | 'Input' => Illuminate\Support\Facades\Input::class,
185 | 'Inspiring' => Illuminate\Foundation\Inspiring::class,
186 | 'Lang' => Illuminate\Support\Facades\Lang::class,
187 | 'Log' => Illuminate\Support\Facades\Log::class,
188 | 'Mail' => Illuminate\Support\Facades\Mail::class,
189 | 'Password' => Illuminate\Support\Facades\Password::class,
190 | 'Queue' => Illuminate\Support\Facades\Queue::class,
191 | 'Redirect' => Illuminate\Support\Facades\Redirect::class,
192 | 'Redis' => Illuminate\Support\Facades\Redis::class,
193 | 'Request' => Illuminate\Support\Facades\Request::class,
194 | 'Response' => Illuminate\Support\Facades\Response::class,
195 | 'Route' => Illuminate\Support\Facades\Route::class,
196 | 'Schema' => Illuminate\Support\Facades\Schema::class,
197 | 'Session' => Illuminate\Support\Facades\Session::class,
198 | 'Storage' => Illuminate\Support\Facades\Storage::class,
199 | 'URL' => Illuminate\Support\Facades\URL::class,
200 | 'Validator' => Illuminate\Support\Facades\Validator::class,
201 | 'View' => Illuminate\Support\Facades\View::class,
202 |
203 | /*
204 | * Third Party Facades...
205 | */
206 | 'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
207 | 'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
208 | ],
209 |
210 | ];
211 |
--------------------------------------------------------------------------------
/config/auth.php:
--------------------------------------------------------------------------------
1 | 'eloquent',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Authentication Model
23 | |--------------------------------------------------------------------------
24 | |
25 | | When using the "Eloquent" authentication driver, we need to know which
26 | | Eloquent model should be used to retrieve your users. Of course, it
27 | | is often just the "User" model but you may use whatever you like.
28 | |
29 | */
30 |
31 | 'model' => App\User::class,
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | Authentication Table
36 | |--------------------------------------------------------------------------
37 | |
38 | | When using the "Database" authentication driver, we need to know which
39 | | table should be used to retrieve your users. We have chosen a basic
40 | | default value but you may easily change it to any table you like.
41 | |
42 | */
43 |
44 | 'table' => 'users',
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Password Reset Settings
49 | |--------------------------------------------------------------------------
50 | |
51 | | Here you may set the options for resetting passwords including the view
52 | | that is your password reset e-mail. You can also set the name of the
53 | | table that maintains all of the reset tokens for your application.
54 | |
55 | | The expire time is the number of minutes that the reset token should be
56 | | considered valid. This security feature keeps tokens short-lived so
57 | | they have less time to be guessed. You may change this as needed.
58 | |
59 | */
60 |
61 | 'password' => [
62 | 'email' => 'emails.password',
63 | 'table' => 'password_resets',
64 | 'expire' => 60,
65 | ],
66 |
67 | ];
68 |
--------------------------------------------------------------------------------
/config/boilerplate.php:
--------------------------------------------------------------------------------
1 | [
16 | 'name', 'email', 'password'
17 | ],
18 |
19 | /*
20 | |--------------------------------------------------------------------------
21 | | Signup Fields Rules
22 | |--------------------------------------------------------------------------
23 | |
24 | | Here you can put the rules you want to use for the validator instance
25 | | in the signup method.
26 | |
27 | */
28 | 'signup_fields_rules' => [
29 | 'name' => 'required',
30 | 'email' => 'required|email',
31 | 'password' => 'required|min:6'
32 | ],
33 |
34 | /*
35 | |--------------------------------------------------------------------------
36 | | Signup Token Release
37 | |--------------------------------------------------------------------------
38 | |
39 | | If this field is "true", an authentication token will be automatically
40 | | released after signup. Otherwise, the signup method will return a simple
41 | | success message.
42 | |
43 | */
44 | 'signup_token_release' => env('API_SIGNUP_TOKEN_RELEASE', true),
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Password Reset Token Release
49 | |--------------------------------------------------------------------------
50 | |
51 | | If this field is "true", an authentication token will be automatically
52 | | released after password reset. Otherwise, the signup method will return a
53 | | simple success message.
54 | |
55 | */
56 | 'reset_token_release' => env('API_RESET_TOKEN_RELEASE', true),
57 |
58 | /*
59 | |--------------------------------------------------------------------------
60 | | Recovery Email Subject
61 | |--------------------------------------------------------------------------
62 | |
63 | | The email address you want use to send the recovery email.
64 | |
65 | */
66 | 'recovery_email_subject' => env('API_RECOVERY_EMAIL_SUBJECT', true),
67 |
68 | ];
--------------------------------------------------------------------------------
/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 | ],
37 |
38 | 'redis' => [
39 | 'driver' => 'redis',
40 | 'connection' => 'default',
41 | ],
42 |
43 | 'log' => [
44 | 'driver' => 'log',
45 | ],
46 |
47 | ],
48 |
49 | ];
50 |
--------------------------------------------------------------------------------
/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' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
55 | ],
56 | ],
57 | ],
58 |
59 | 'redis' => [
60 | 'driver' => 'redis',
61 | 'connection' => 'default',
62 | ],
63 |
64 | ],
65 |
66 | /*
67 | |--------------------------------------------------------------------------
68 | | Cache Key Prefix
69 | |--------------------------------------------------------------------------
70 | |
71 | | When utilizing a RAM based store such as APC or Memcached, there might
72 | | be other applications utilizing the same cache. So, we'll specify a
73 | | value to get prefixed to all our keys so we can avoid collisions.
74 | |
75 | */
76 |
77 | 'prefix' => 'laravel',
78 |
79 | ];
80 |
--------------------------------------------------------------------------------
/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/cors.php:
--------------------------------------------------------------------------------
1 | false,
14 | 'allowedOrigins' => ['*'],
15 | 'allowedHeaders' => ['*'],
16 | 'allowedMethods' => ['GET', 'POST', 'PUT', 'DELETE'],
17 | 'exposedHeaders' => [],
18 | 'maxAge' => 0,
19 | 'hosts' => [],
20 | ];
21 |
--------------------------------------------------------------------------------
/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' => storage_path('database.sqlite'),
52 | 'prefix' => '',
53 | ],
54 |
55 | 'mysql' => [
56 | 'driver' => 'mysql',
57 | 'host' => env('DB_HOST', 'localhost'),
58 | 'database' => env('DB_DATABASE', 'forge'),
59 | 'username' => env('DB_USERNAME', 'forge'),
60 | 'password' => env('DB_PASSWORD', ''),
61 | 'charset' => 'utf8',
62 | 'collation' => 'utf8_unicode_ci',
63 | 'prefix' => '',
64 | 'strict' => false,
65 | ],
66 |
67 | 'pgsql' => [
68 | 'driver' => 'pgsql',
69 | 'host' => env('DB_HOST', 'localhost'),
70 | 'database' => env('DB_DATABASE', 'forge'),
71 | 'username' => env('DB_USERNAME', 'forge'),
72 | 'password' => env('DB_PASSWORD', ''),
73 | 'charset' => 'utf8',
74 | 'prefix' => '',
75 | 'schema' => 'public',
76 | ],
77 |
78 | 'sqlsrv' => [
79 | 'driver' => 'sqlsrv',
80 | 'host' => env('DB_HOST', 'localhost'),
81 | 'database' => env('DB_DATABASE', 'forge'),
82 | 'username' => env('DB_USERNAME', 'forge'),
83 | 'password' => env('DB_PASSWORD', ''),
84 | 'charset' => 'utf8',
85 | 'prefix' => '',
86 | ],
87 |
88 | ],
89 |
90 | /*
91 | |--------------------------------------------------------------------------
92 | | Migration Repository Table
93 | |--------------------------------------------------------------------------
94 | |
95 | | This table keeps track of all the migrations that have already run for
96 | | your application. Using this information, we can determine which of
97 | | the migrations on disk haven't actually been run in the database.
98 | |
99 | */
100 |
101 | 'migrations' => 'migrations',
102 |
103 | /*
104 | |--------------------------------------------------------------------------
105 | | Redis Databases
106 | |--------------------------------------------------------------------------
107 | |
108 | | Redis is an open source, fast, and advanced key-value store that also
109 | | provides a richer set of commands than a typical key-value systems
110 | | such as APC or Memcached. Laravel makes it easy to dig right in.
111 | |
112 | */
113 |
114 | 'redis' => [
115 |
116 | 'cluster' => false,
117 |
118 | 'default' => [
119 | 'host' => '127.0.0.1',
120 | 'port' => 6379,
121 | 'database' => 0,
122 | ],
123 |
124 | ],
125 |
126 | ];
127 |
--------------------------------------------------------------------------------
/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 | 'ftp' => [
52 | 'driver' => 'ftp',
53 | 'host' => 'ftp.example.com',
54 | 'username' => 'your-username',
55 | 'password' => 'your-password',
56 |
57 | // Optional FTP Settings...
58 | // 'port' => 21,
59 | // 'root' => '',
60 | // 'passive' => true,
61 | // 'ssl' => true,
62 | // 'timeout' => 30,
63 | ],
64 |
65 | 's3' => [
66 | 'driver' => 's3',
67 | 'key' => 'your-key',
68 | 'secret' => 'your-secret',
69 | 'region' => 'your-region',
70 | 'bucket' => 'your-bucket',
71 | ],
72 |
73 | 'rackspace' => [
74 | 'driver' => 'rackspace',
75 | 'username' => 'your-username',
76 | 'key' => 'your-key',
77 | 'container' => 'your-container',
78 | 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
79 | 'region' => 'IAD',
80 | 'url_type' => 'publicURL',
81 | ],
82 |
83 | ],
84 |
85 | ];
86 |
--------------------------------------------------------------------------------
/config/jwt.php:
--------------------------------------------------------------------------------
1 | env('JWT_SECRET', 'YoMeKKnyzctPKzmI9boWsFpVnNYS2o7U'),
16 |
17 | /*
18 | |--------------------------------------------------------------------------
19 | | JWT time to live
20 | |--------------------------------------------------------------------------
21 | |
22 | | Specify the length of time (in minutes) that the token will be valid for.
23 | | Defaults to 1 hour
24 | |
25 | */
26 |
27 | 'ttl' => 1440,
28 |
29 | /*
30 | |--------------------------------------------------------------------------
31 | | Refresh time to live
32 | |--------------------------------------------------------------------------
33 | |
34 | | Specify the length of time (in minutes) that the token can be refreshed
35 | | within. I.E. The user can refresh their token within a 2 week window of
36 | | the original token being created until they must re-authenticate.
37 | | Defaults to 2 weeks
38 | |
39 | */
40 |
41 | 'refresh_ttl' => 20160,
42 |
43 | /*
44 | |--------------------------------------------------------------------------
45 | | JWT hashing algorithm
46 | |--------------------------------------------------------------------------
47 | |
48 | | Specify the hashing algorithm that will be used to sign the token.
49 | |
50 | | See here: https://github.com/namshi/jose/tree/2.2.0/src/Namshi/JOSE/Signer
51 | | for possible values
52 | |
53 | */
54 |
55 | 'algo' => 'HS256',
56 |
57 | /*
58 | |--------------------------------------------------------------------------
59 | | User Model namespace
60 | |--------------------------------------------------------------------------
61 | |
62 | | Specify the full namespace to your User model.
63 | | e.g. 'Acme\Entities\User'
64 | |
65 | */
66 |
67 | 'user' => 'App\User',
68 |
69 | /*
70 | |--------------------------------------------------------------------------
71 | | User identifier
72 | |--------------------------------------------------------------------------
73 | |
74 | | Specify a unique property of the user that will be added as the 'sub'
75 | | claim of the token payload.
76 | |
77 | */
78 |
79 | 'identifier' => 'id',
80 |
81 | /*
82 | |--------------------------------------------------------------------------
83 | | Required Claims
84 | |--------------------------------------------------------------------------
85 | |
86 | | Specify the required claims that must exist in any token.
87 | | A TokenInvalidException will be thrown if any of these claims are not
88 | | present in the payload.
89 | |
90 | */
91 |
92 | 'required_claims' => ['iss', 'iat', 'exp', 'nbf', 'sub', 'jti'],
93 |
94 | /*
95 | |--------------------------------------------------------------------------
96 | | Blacklist Enabled
97 | |--------------------------------------------------------------------------
98 | |
99 | | In order to invalidate tokens, you must have the the blacklist enabled.
100 | | If you do not want or need this functionality, then set this to false.
101 | |
102 | */
103 |
104 | 'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
105 |
106 | /*
107 | |--------------------------------------------------------------------------
108 | | Providers
109 | |--------------------------------------------------------------------------
110 | |
111 | | Specify the various providers used throughout the package.
112 | |
113 | */
114 |
115 | 'providers' => [
116 |
117 | /*
118 | |--------------------------------------------------------------------------
119 | | User Provider
120 | |--------------------------------------------------------------------------
121 | |
122 | | Specify the provider that is used to find the user based
123 | | on the subject claim
124 | |
125 | */
126 |
127 | 'user' => 'Tymon\JWTAuth\Providers\User\EloquentUserAdapter',
128 |
129 | /*
130 | |--------------------------------------------------------------------------
131 | | JWT Provider
132 | |--------------------------------------------------------------------------
133 | |
134 | | Specify the provider that is used to create and decode the tokens.
135 | |
136 | */
137 |
138 | 'jwt' => 'Tymon\JWTAuth\Providers\JWT\NamshiAdapter',
139 |
140 | /*
141 | |--------------------------------------------------------------------------
142 | | Authentication Provider
143 | |--------------------------------------------------------------------------
144 | |
145 | | Specify the provider that is used to authenticate users.
146 | |
147 | */
148 |
149 | 'auth' => function ($app) {
150 | return new Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter($app['auth']);
151 | },
152 |
153 | /*
154 | |--------------------------------------------------------------------------
155 | | Storage Provider
156 | |--------------------------------------------------------------------------
157 | |
158 | | Specify the provider that is used to store tokens in the blacklist
159 | |
160 | */
161 |
162 | 'storage' => function ($app) {
163 | return new Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter($app['cache']);
164 | }
165 |
166 | ]
167 |
168 | ];
169 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_DRIVER', 'smtp'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | SMTP Host Address
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may provide the host address of the SMTP server used by your
26 | | applications. A default option is provided that is compatible with
27 | | the Mailgun mail service which will provide reliable deliveries.
28 | |
29 | */
30 |
31 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | SMTP Host Port
36 | |--------------------------------------------------------------------------
37 | |
38 | | This is the SMTP port used by your application to deliver e-mails to
39 | | users of the application. Like the host we have set this value to
40 | | stay compatible with the Mailgun e-mail application by default.
41 | |
42 | */
43 |
44 | 'port' => env('MAIL_PORT', 587),
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Global "From" Address
49 | |--------------------------------------------------------------------------
50 | |
51 | | You may wish for all e-mails sent by your application to be sent from
52 | | the same address. Here, you may specify a name and address that is
53 | | used globally for all e-mails that are sent by your application.
54 | |
55 | */
56 |
57 | 'from' => ['address' => null, 'name' => null],
58 |
59 | /*
60 | |--------------------------------------------------------------------------
61 | | E-Mail Encryption Protocol
62 | |--------------------------------------------------------------------------
63 | |
64 | | Here you may specify the encryption protocol that should be used when
65 | | the application send e-mail messages. A sensible default using the
66 | | transport layer security protocol should provide great security.
67 | |
68 | */
69 |
70 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
71 |
72 | /*
73 | |--------------------------------------------------------------------------
74 | | SMTP Server Username
75 | |--------------------------------------------------------------------------
76 | |
77 | | If your SMTP server requires a username for authentication, you should
78 | | set it here. This will get used to authenticate with your server on
79 | | connection. You may also set the "password" value below this one.
80 | |
81 | */
82 |
83 | 'username' => env('MAIL_USERNAME'),
84 |
85 | /*
86 | |--------------------------------------------------------------------------
87 | | SMTP Server Password
88 | |--------------------------------------------------------------------------
89 | |
90 | | Here you may set the password required by your SMTP server to send out
91 | | messages from your application. This will be given to the server on
92 | | connection so that the application will be able to send messages.
93 | |
94 | */
95 |
96 | 'password' => env('MAIL_PASSWORD'),
97 |
98 | /*
99 | |--------------------------------------------------------------------------
100 | | Sendmail System Path
101 | |--------------------------------------------------------------------------
102 | |
103 | | When using the "sendmail" driver to send e-mails, we will need to know
104 | | the path to where Sendmail lives on this server. A default path has
105 | | been provided here, which will work well on most of your systems.
106 | |
107 | */
108 |
109 | 'sendmail' => '/usr/sbin/sendmail -bs',
110 |
111 | /*
112 | |--------------------------------------------------------------------------
113 | | Mail "Pretend"
114 | |--------------------------------------------------------------------------
115 | |
116 | | When this option is enabled, e-mail will not actually be sent over the
117 | | web and will instead be written to your application's logs files so
118 | | you may inspect the message. This is great for local development.
119 | |
120 | */
121 |
122 | 'pretend' => true,
123 |
124 | ];
125 |
--------------------------------------------------------------------------------
/config/queue.php:
--------------------------------------------------------------------------------
1 | env('QUEUE_DRIVER', 'sync'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Queue Connections
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may configure the connection information for each server that
27 | | is used by your application. A default configuration has been added
28 | | for each back-end shipped with Laravel. You are free to add more.
29 | |
30 | */
31 |
32 | 'connections' => [
33 |
34 | 'sync' => [
35 | 'driver' => 'sync',
36 | ],
37 |
38 | 'database' => [
39 | 'driver' => 'database',
40 | 'table' => 'jobs',
41 | 'queue' => 'default',
42 | 'expire' => 60,
43 | ],
44 |
45 | 'beanstalkd' => [
46 | 'driver' => 'beanstalkd',
47 | 'host' => 'localhost',
48 | 'queue' => 'default',
49 | 'ttr' => 60,
50 | ],
51 |
52 | 'sqs' => [
53 | 'driver' => 'sqs',
54 | 'key' => 'your-public-key',
55 | 'secret' => 'your-secret-key',
56 | 'queue' => 'your-queue-url',
57 | 'region' => 'us-east-1',
58 | ],
59 |
60 | 'iron' => [
61 | 'driver' => 'iron',
62 | 'host' => 'mq-aws-us-east-1.iron.io',
63 | 'token' => 'your-token',
64 | 'project' => 'your-project-id',
65 | 'queue' => 'your-queue-name',
66 | 'encrypt' => true,
67 | ],
68 |
69 | 'redis' => [
70 | 'driver' => 'redis',
71 | 'connection' => 'default',
72 | 'queue' => 'default',
73 | 'expire' => 60,
74 | ],
75 |
76 | ],
77 |
78 | /*
79 | |--------------------------------------------------------------------------
80 | | Failed Queue Jobs
81 | |--------------------------------------------------------------------------
82 | |
83 | | These options configure the behavior of failed queue job logging so you
84 | | can control which database and table are used to store the jobs that
85 | | have failed. You may change them to any database / table you wish.
86 | |
87 | */
88 |
89 | 'failed' => [
90 | 'database' => 'mysql', 'table' => 'failed_jobs',
91 | ],
92 |
93 | ];
94 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | ],
21 |
22 | 'mandrill' => [
23 | 'secret' => env('MANDRILL_SECRET'),
24 | ],
25 |
26 | 'ses' => [
27 | 'key' => env('SES_KEY'),
28 | 'secret' => env('SES_SECRET'),
29 | 'region' => 'us-east-1',
30 | ],
31 |
32 | 'stripe' => [
33 | 'model' => App\User::class,
34 | 'key' => env('STRIPE_KEY'),
35 | 'secret' => env('STRIPE_SECRET'),
36 | ],
37 |
38 | ];
39 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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->email,
18 | 'password' => bcrypt(str_random(10)),
19 | 'remember_token' => str_random(10),
20 | ];
21 | });
22 |
--------------------------------------------------------------------------------
/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/francescomalatesta/laravel-api-boilerplate-angular-example/e44df28f495448b730d5ebf8c181abacf9eb51ef/database/migrations/.gitkeep
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('name');
18 | $table->string('email')->unique();
19 | $table->string('password', 60);
20 | $table->rememberToken();
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::drop('users');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
17 | $table->string('token')->index();
18 | $table->timestamp('created_at');
19 | });
20 | }
21 |
22 | /**
23 | * Reverse the migrations.
24 | *
25 | * @return void
26 | */
27 | public function down()
28 | {
29 | Schema::drop('password_resets');
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/database/migrations/2015_09_24_083259_create_books_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 |
18 | // adding specific fields here...
19 | $table->string('title');
20 | $table->string('author_name');
21 | $table->integer('pages_count');
22 |
23 | $table->integer('user_id')->index();
24 |
25 | $table->timestamps();
26 | });
27 | }
28 |
29 | /**
30 | * Reverse the migrations.
31 | *
32 | * @return void
33 | */
34 | public function down()
35 | {
36 | Schema::drop('books');
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/database/seeds/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/francescomalatesta/laravel-api-boilerplate-angular-example/e44df28f495448b730d5ebf8c181abacf9eb51ef/database/seeds/.gitkeep
--------------------------------------------------------------------------------
/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | call(UserTableSeeder::class);
18 |
19 | Model::reguard();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/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 | "devDependencies": {
4 | "gulp": "^3.8.8"
5 | },
6 | "dependencies": {
7 | "laravel-elixir": "^3.0.0",
8 | "bootstrap-sass": "^3.0.0"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/phpspec.yml:
--------------------------------------------------------------------------------
1 | suites:
2 | main:
3 | namespace: App
4 | psr4_prefix: App
5 | src_path: app
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
You currently have {{ books.length }} books in your wishlist.
12 |Welcome! Use this form to login into your application.
5 | 6 |Welcome! If you want to sign up to our awesome service, fill this form and press on "Signup"!
5 | 6 |