├── database
├── migrations
│ ├── .gitkeep
│ └── 2014_10_12_000000_create_users_table.php
├── seeds
│ └── DatabaseSeeder.php
└── factories
│ └── ModelFactory.php
├── resources
└── views
│ └── .gitkeep
├── app
├── Console
│ ├── Commands
│ │ └── .gitkeep
│ └── Kernel.php
├── Events
│ ├── Event.php
│ └── ExampleEvent.php
├── Http
│ ├── Controllers
│ │ ├── Controller.php
│ │ ├── ExampleController.php
│ │ ├── AuthorController.php
│ │ ├── BookController.php
│ │ └── UserController.php
│ └── Middleware
│ │ ├── ExampleMiddleware.php
│ │ └── Authenticate.php
├── Providers
│ ├── AppServiceProvider.php
│ ├── EventServiceProvider.php
│ └── AuthServiceProvider.php
├── Jobs
│ ├── ExampleJob.php
│ └── Job.php
├── Listeners
│ └── ExampleListener.php
├── Traits
│ ├── ConsumesExternalService.php
│ └── ApiResponser.php
├── User.php
├── Services
│ ├── BookService.php
│ └── AuthorService.php
└── Exceptions
│ └── Handler.php
├── storage
├── app
│ └── .gitignore
├── logs
│ └── .gitignore
└── framework
│ ├── cache
│ └── .gitignore
│ └── views
│ └── .gitignore
├── .gitignore
├── config
├── services.php
└── auth.php
├── tests
├── TestCase.php
└── ExampleTest.php
├── .env.example
├── public
├── .htaccess
└── index.php
├── phpunit.xml
├── artisan
├── composer.json
├── readme.md
├── routes
└── web.php
└── bootstrap
└── app.php
/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/views/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/Console/Commands/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 | /.idea
3 | Homestead.json
4 | Homestead.yaml
5 | .env
6 | database/database.sqlite
7 | *sublime*
8 | storage/*.key
9 |
--------------------------------------------------------------------------------
/app/Events/Event.php:
--------------------------------------------------------------------------------
1 | call('UsersTableSeeder');
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
5 | 'base_uri' => env('AUTHORS_SERVICE_BASE_URL'),
6 | 'secret' => env('AUTHORS_SERVICE_SECRET'),
7 | ],
8 |
9 | 'books' => [
10 | 'base_uri' => env('BOOKS_SERVICE_BASE_URL'),
11 | 'secret' => env('BOOKS_SERVICE_SECRET'),
12 | ],
13 | ];
14 |
--------------------------------------------------------------------------------
/tests/TestCase.php:
--------------------------------------------------------------------------------
1 | [
16 | 'App\Listeners\ExampleListener',
17 | ],
18 | ];
19 | }
20 |
--------------------------------------------------------------------------------
/tests/ExampleTest.php:
--------------------------------------------------------------------------------
1 | get('/');
16 |
17 | $this->assertEquals(
18 | $this->app->version(), $this->response->getContent()
19 | );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/Listeners/ExampleListener.php:
--------------------------------------------------------------------------------
1 | define(App\User::class, function (Faker\Generator $faker) {
15 | return [
16 | 'name' => $faker->name,
17 | 'email' => $faker->email,
18 | ];
19 | });
20 |
--------------------------------------------------------------------------------
/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews -Indexes
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Handle Authorization Header
9 | RewriteCond %{HTTP:Authorization} .
10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
11 |
12 | # Redirect Trailing Slashes If Not A Folder...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_URI} (.+)/$
15 | RewriteRule ^ %1 [L,R=301]
16 |
17 | # Handle Front Controller...
18 | RewriteCond %{REQUEST_FILENAME} !-d
19 | RewriteCond %{REQUEST_FILENAME} !-f
20 | RewriteRule ^ index.php [L]
21 |
22 |
--------------------------------------------------------------------------------
/app/Traits/ConsumesExternalService.php:
--------------------------------------------------------------------------------
1 | $this->baseUri,
17 | ]);
18 |
19 | if (isset($this->secret)) {
20 | $headers['Authorization'] = $this->secret;
21 | }
22 |
23 | $response = $client->request($method, $requestUrl, ['form_params' => $formParams, 'headers' => $headers]);
24 |
25 | return $response->getBody()->getContents();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/Jobs/Job.php:
--------------------------------------------------------------------------------
1 | bigIncrements('id');
18 | $table->string('name');
19 | $table->string('email')->unique();
20 | $table->string('password');
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::dropIfExists('users');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/User.php:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests
14 |
15 |
16 |
17 |
18 | ./app
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 | run();
29 |
--------------------------------------------------------------------------------
/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 | * @param string|null $guard
34 | * @return mixed
35 | */
36 | public function handle($request, Closure $next, $guard = null)
37 | {
38 | if ($this->auth->guard($guard)->guest()) {
39 | return response('Unauthorized.', 401);
40 | }
41 |
42 | return $next($request);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/artisan:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | make(
32 | 'Illuminate\Contracts\Console\Kernel'
33 | );
34 |
35 | exit($kernel->handle(new ArgvInput, new ConsoleOutput));
36 |
--------------------------------------------------------------------------------
/app/Providers/AuthServiceProvider.php:
--------------------------------------------------------------------------------
1 | app['auth']->viaRequest('api', function ($request) {
33 | if ($request->input('api_token')) {
34 | return User::where('api_token', $request->input('api_token'))->first();
35 | }
36 | });*/
37 |
38 | LumenPassport::routes($this->app->router);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "laravel/lumen",
3 | "description": "The Laravel Lumen Framework.",
4 | "keywords": ["framework", "laravel", "lumen"],
5 | "license": "MIT",
6 | "type": "project",
7 | "require": {
8 | "php": ">=7.1.3",
9 | "dusterio/lumen-passport": "^0.2.8",
10 | "guzzlehttp/guzzle": "^6.3",
11 | "laravel/lumen-framework": "5.7.*",
12 | "vlucas/phpdotenv": "~2.2"
13 | },
14 | "require-dev": {
15 | "fzaninotto/faker": "~1.4",
16 | "phpunit/phpunit": "~7.0",
17 | "mockery/mockery": "~1.0"
18 | },
19 | "autoload": {
20 | "classmap": [
21 | "database/seeds",
22 | "database/factories"
23 | ],
24 | "psr-4": {
25 | "App\\": "app/"
26 | }
27 | },
28 | "autoload-dev": {
29 | "classmap": [
30 | "tests/"
31 | ]
32 | },
33 | "scripts": {
34 | "post-root-package-install": [
35 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
36 | ]
37 | },
38 | "config": {
39 | "preferred-install": "dist",
40 | "sort-packages": true,
41 | "optimize-autoloader": true
42 | },
43 | "minimum-stability": "dev",
44 | "prefer-stable": true
45 | }
46 |
--------------------------------------------------------------------------------
/app/Traits/ApiResponser.php:
--------------------------------------------------------------------------------
1 | header('Content-Type', 'application/json');
18 | }
19 |
20 | /**
21 | * Build a valid response
22 | * @param string|array $data
23 | * @param int $code
24 | * @return Illuminate\Http\JsonResponse
25 | */
26 | public function validResponse($data, $code = Response::HTTP_OK)
27 | {
28 | return response()->json(['data' => $data], $code);
29 | }
30 |
31 | /**
32 | * Build error responses
33 | * @param string $message
34 | * @param int $code
35 | * @return Illuminate\Http\JsonResponse
36 | */
37 | public function errorResponse($message, $code)
38 | {
39 | return response()->json(['error' => $message, 'code' => $code], $code);
40 | }
41 |
42 | /**
43 | * Return an error in JSON format
44 | * @param string $message
45 | * @param int $code
46 | * @return Illuminate\Http\Response
47 | */
48 | public function errorMessage($message, $code)
49 | {
50 | return response($message, $code)->header('Content-Type', 'application/json');
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Lumen PHP Framework
2 |
3 | [](https://travis-ci.org/laravel/lumen-framework)
4 | [](https://packagist.org/packages/laravel/lumen-framework)
5 | [](https://packagist.org/packages/laravel/lumen-framework)
6 | [](https://packagist.org/packages/laravel/lumen-framework)
7 | [](https://packagist.org/packages/laravel/lumen-framework)
8 |
9 | Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Lumen attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as routing, database abstraction, queueing, and caching.
10 |
11 | ## Official Documentation
12 |
13 | Documentation for the framework can be found on the [Lumen website](http://lumen.laravel.com/docs).
14 |
15 | ## Security Vulnerabilities
16 |
17 | If you discover a security vulnerability within Lumen, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
18 |
19 | ## License
20 |
21 | The Lumen framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
22 |
--------------------------------------------------------------------------------
/app/Services/BookService.php:
--------------------------------------------------------------------------------
1 | baseUri = config('services.books.base_uri');
26 | $this->secret = config('services.books.secret');
27 | }
28 |
29 | /**
30 | * Get the full list of books from the books service
31 | * @return string
32 | */
33 | public function obtainBooks()
34 | {
35 | return $this->performRequest('GET', '/books');
36 | }
37 |
38 | /**
39 | * Create an instance of book using the books service
40 | * @return string
41 | */
42 | public function createBook($data)
43 | {
44 | return $this->performRequest('POST', '/books', $data);
45 | }
46 |
47 | /**
48 | * Get a single book from the books service
49 | * @return string
50 | */
51 | public function obtainBook($book)
52 | {
53 | return $this->performRequest('GET', "/books/{$book}");
54 | }
55 |
56 | /**
57 | * Edit a single book from the books service
58 | * @return string
59 | */
60 | public function editBook($data, $book)
61 | {
62 | return $this->performRequest('PUT', "/books/{$book}", $data);
63 | }
64 |
65 | /**
66 | * Remove a single book from the books service
67 | * @return string
68 | */
69 | public function deleteBook($book)
70 | {
71 | return $this->performRequest('DELETE', "/books/{$book}");
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/app/Services/AuthorService.php:
--------------------------------------------------------------------------------
1 | baseUri = config('services.authors.base_uri');
26 | $this->secret = config('services.authors.secret');
27 | }
28 |
29 | /**
30 | * Get the full list of authors from the authors service
31 | * @return string
32 | */
33 | public function obtainAuthors()
34 | {
35 | return $this->performRequest('GET', '/authors');
36 | }
37 |
38 | /**
39 | * Create an instance of author using the authors service
40 | * @return string
41 | */
42 | public function createAuthor($data)
43 | {
44 | return $this->performRequest('POST', '/authors', $data);
45 | }
46 |
47 | /**
48 | * Get a single author from the authors service
49 | * @return string
50 | */
51 | public function obtainAuthor($author)
52 | {
53 | return $this->performRequest('GET', "/authors/{$author}");
54 | }
55 |
56 | /**
57 | * Edit a single author from the authors service
58 | * @return string
59 | */
60 | public function editAuthor($data, $author)
61 | {
62 | return $this->performRequest('PUT', "/authors/{$author}", $data);
63 | }
64 |
65 | /**
66 | * Remove a single author from the authors service
67 | * @return string
68 | */
69 | public function deleteAuthor($author)
70 | {
71 | return $this->performRequest('DELETE', "/authors/{$author}");
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/routes/web.php:
--------------------------------------------------------------------------------
1 | group(['middleware' => 'client.credentials'], function () use ($router) {
15 | /**
16 | * Authors routes
17 | */
18 | $router->get('/authors', 'AuthorController@index');
19 | $router->post('/authors', 'AuthorController@store');
20 | $router->get('/authors/{author}', 'AuthorController@show');
21 | $router->put('/authors/{author}', 'AuthorController@update');
22 | $router->patch('/authors/{author}', 'AuthorController@update');
23 | $router->delete('/authors/{author}', 'AuthorController@destroy');
24 |
25 | /**
26 | * Books routes
27 | */
28 | $router->get('/books', 'BookController@index');
29 | $router->post('/books', 'BookController@store');
30 | $router->get('/books/{book}', 'BookController@show');
31 | $router->put('/books/{book}', 'BookController@update');
32 | $router->patch('/books/{book}', 'BookController@update');
33 | $router->delete('/books/{book}', 'BookController@destroy');
34 |
35 | /**
36 | * Users routes
37 | */
38 | $router->get('/users', 'UserController@index');
39 | $router->post('/users', 'UserController@store');
40 | $router->get('/users/{user}', 'UserController@show');
41 | $router->put('/users/{user}', 'UserController@update');
42 | $router->patch('/users/{user}', 'UserController@update');
43 | $router->delete('/users/{user}', 'UserController@destroy');
44 | });
45 |
46 | /**
47 | * Routes protected by user credentials
48 | */
49 | $router->group(['middleware' => 'auth:api'], function () use ($router) {
50 | $router->get('/users/me', 'UserController@me');
51 | });
52 |
--------------------------------------------------------------------------------
/app/Http/Controllers/AuthorController.php:
--------------------------------------------------------------------------------
1 | authorService = $authorService;
28 | }
29 |
30 | /**
31 | * Retrieve and show all the authors
32 | * @return Illuminate\Http\Response
33 | */
34 | public function index()
35 | {
36 | return $this->successResponse($this->authorService->obtainAuthors());
37 | }
38 |
39 | /**
40 | * Creates an instance of author
41 | * @return Illuminate\Http\Response
42 | */
43 | public function store(Request $request)
44 | {
45 | return $this->successResponse($this->authorService->createAuthor($request->all()), Response::HTTP_CREATED);
46 | }
47 |
48 | /**
49 | * Obtain and show an instance of author
50 | * @return Illuminate\Http\Response
51 | */
52 | public function show($author)
53 | {
54 | return $this->successResponse($this->authorService->obtainAuthor($author));
55 | }
56 |
57 | /**
58 | * Updated an instance of author
59 | * @return Illuminate\Http\Response
60 | */
61 | public function update(Request $request, $author)
62 | {
63 | return $this->successResponse($this->authorService->editAuthor($request->all(), $author));
64 | }
65 |
66 | /**
67 | * Removes an instance of author
68 | * @return Illuminate\Http\Response
69 | */
70 | public function destroy($author)
71 | {
72 | return $this->successResponse($this->authorService->deleteAuthor($author));
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/app/Http/Controllers/BookController.php:
--------------------------------------------------------------------------------
1 | bookService = $bookService;
35 | $this->authorService = $authorService;
36 | }
37 |
38 | /**
39 | * Retrieve and show all the Books
40 | * @return Illuminate\Http\Response
41 | */
42 | public function index()
43 | {
44 | return $this->successResponse($this->bookService->obtainBooks());
45 | }
46 |
47 | /**
48 | * Creates an instance of Book
49 | * @return Illuminate\Http\Response
50 | */
51 | public function store(Request $request)
52 | {
53 | $this->authorService->obtainAuthor($request->author_id);
54 |
55 | return $this->successResponse($this->bookService->createBook($request->all()), Response::HTTP_CREATED);
56 | }
57 |
58 | /**
59 | * Obtain and show an instance of Book
60 | * @return Illuminate\Http\Response
61 | */
62 | public function show($book)
63 | {
64 | return $this->successResponse($this->bookService->obtainBook($book));
65 | }
66 |
67 | /**
68 | * Updated an instance of Book
69 | * @return Illuminate\Http\Response
70 | */
71 | public function update(Request $request, $book)
72 | {
73 | return $this->successResponse($this->bookService->editBook($request->all(), $book));
74 | }
75 |
76 | /**
77 | * Removes an instance of Book
78 | * @return Illuminate\Http\Response
79 | */
80 | public function destroy($book)
81 | {
82 | return $this->successResponse($this->bookService->deleteBook($book));
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/app/Exceptions/Handler.php:
--------------------------------------------------------------------------------
1 | getStatusCode();
56 | $message = Response::$statusTexts[$code];
57 |
58 | return $this->errorResponse($message, $code);
59 | }
60 |
61 | if ($exception instanceof ModelNotFoundException) {
62 | $model = strtolower(class_basename($exception->getModel()));
63 |
64 | return $this->errorResponse("Does not exist any instance of {$model} with the given id", Response::HTTP_NOT_FOUND);
65 | }
66 |
67 | if ($exception instanceof AuthorizationException) {
68 | return $this->errorResponse($exception->getMessage(), Response::HTTP_FORBIDDEN);
69 | }
70 |
71 | if ($exception instanceof AuthenticationException) {
72 | return $this->errorResponse($exception->getMessage(), Response::HTTP_UNAUTHORIZED);
73 | }
74 |
75 | if ($exception instanceof ValidationException) {
76 | $errors = $exception->validator->errors()->getMessages();
77 |
78 | return $this->errorResponse($errors, Response::HTTP_UNPROCESSABLE_ENTITY);
79 | }
80 |
81 | if ($exception instanceof ClientException) {
82 | $message = $exception->getResponse()->getBody();
83 | $code = $exception->getCode();
84 |
85 | return $this->errorMessage($message, $code);
86 | }
87 |
88 | if (env('APP_DEBUG', false)) {
89 | return parent::render($request, $exception);
90 | }
91 |
92 | return $this->errorResponse('Unexpected error. Try later', Response::HTTP_INTERNAL_SERVER_ERROR);
93 |
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/app/Http/Controllers/UserController.php:
--------------------------------------------------------------------------------
1 | validResponse($users);
34 | }
35 |
36 | /**
37 | * Create an instance of User
38 | * @return Illuminate\Http\Response
39 | */
40 | public function store(Request $request)
41 | {
42 | $rules = [
43 | 'name' => 'required|max:255',
44 | 'email' => 'required|email|unique:users,email',
45 | 'password' => 'required|min:8|confirmed',
46 | ];
47 |
48 | $this->validate($request, $rules);
49 |
50 | $fields = $request->all();
51 | $fields['password'] = Hash::make($request->password);
52 |
53 | $user = User::create($fields);
54 |
55 | return $this->validResponse($user, Response::HTTP_CREATED);
56 | }
57 |
58 | /**
59 | * Return an specific user
60 | * @return Illuminate\Http\Response
61 | */
62 | public function show($user)
63 | {
64 | $user = User::findOrFail($user);
65 |
66 | return $this->validResponse($user);
67 | }
68 |
69 | /**
70 | * Update the information of an existing user
71 | * @return Illuminate\Http\Response
72 | */
73 | public function update(Request $request, $user)
74 | {
75 | $rules = [
76 | 'name' => 'max:255',
77 | 'email' => 'email|unique:users,email,' . $user,
78 | 'password' => 'min:8|confirmed',
79 | ];
80 |
81 | $this->validate($request, $rules);
82 |
83 | $user = User::findOrFail($user);
84 |
85 | $user->fill($request->all());
86 |
87 | if ($request->has('password')) {
88 | $user->password = Hash::make($request->password);
89 | }
90 |
91 | if ($user->isClean()) {
92 | return $this->errorResponse('At least one value must change', Response::HTTP_UNPROCESSABLE_ENTITY);
93 | }
94 |
95 | $user->save();
96 |
97 | return $this->validResponse($user);
98 | }
99 |
100 | /**
101 | * Removes an existing user
102 | * @return Illuminate\Http\Response
103 | */
104 | public function destroy($user)
105 | {
106 | $user = User::findOrFail($user);
107 |
108 | $user->delete();
109 |
110 | return $this->validResponse($user);
111 | }
112 |
113 | /**
114 | * Identifies the curren user
115 | * @return Illuminate\Http\Response
116 | */
117 | public function me(Request $request)
118 | {
119 | return $this->validResponse($request->user());
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/config/auth.php:
--------------------------------------------------------------------------------
1 | [
17 | 'guard' => env('AUTH_GUARD', 'api'),
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Authentication Guards
23 | |--------------------------------------------------------------------------
24 | |
25 | | Next, you may define every authentication guard for your application.
26 | | Of course, a great default configuration has been defined for you
27 | | here which uses session storage and the Eloquent user provider.
28 | |
29 | | All authentication drivers have a user provider. This defines how the
30 | | users are actually retrieved out of your database or other storage
31 | | mechanisms used by this application to persist your user's data.
32 | |
33 | | Supported: "token"
34 | |
35 | */
36 |
37 | 'guards' => [
38 | 'api' => [
39 | 'driver' => 'passport',
40 | 'provider' => 'users',
41 | ],
42 | ],
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | User Providers
47 | |--------------------------------------------------------------------------
48 | |
49 | | All authentication drivers have a user provider. This defines how the
50 | | users are actually retrieved out of your database or other storage
51 | | mechanisms used by this application to persist your user's data.
52 | |
53 | | If you have multiple user tables or models you may configure multiple
54 | | sources which represent each model / table. These sources may then
55 | | be assigned to any extra authentication guards you have defined.
56 | |
57 | | Supported: "database", "eloquent"
58 | |
59 | */
60 |
61 | 'providers' => [
62 | 'users' => [
63 | 'driver' => 'eloquent',
64 | 'model' => App\User::class,
65 | ],
66 | ],
67 |
68 | /*
69 | |--------------------------------------------------------------------------
70 | | Resetting Passwords
71 | |--------------------------------------------------------------------------
72 | |
73 | | Here you may set the options for resetting passwords including the view
74 | | that is your password reset e-mail. You may also set the name of the
75 | | table that maintains all of the reset tokens for your application.
76 | |
77 | | You may specify multiple password reset configurations if you have more
78 | | than one user table or model in the application and you want to have
79 | | separate password reset settings based on the specific user types.
80 | |
81 | | The expire time is the number of minutes that the reset token should be
82 | | considered valid. This security feature keeps tokens short-lived so
83 | | they have less time to be guessed. You may change this as needed.
84 | |
85 | */
86 |
87 | 'passwords' => [
88 | //
89 | ],
90 |
91 | ];
92 |
--------------------------------------------------------------------------------
/bootstrap/app.php:
--------------------------------------------------------------------------------
1 | load();
7 | } catch (Dotenv\Exception\InvalidPathException $e) {
8 | //
9 | }
10 |
11 | /*
12 | |--------------------------------------------------------------------------
13 | | Create The Application
14 | |--------------------------------------------------------------------------
15 | |
16 | | Here we will load the environment and create the application instance
17 | | that serves as the central piece of this framework. We'll use this
18 | | application as an "IoC" container and router for this framework.
19 | |
20 | */
21 |
22 | $app = new Laravel\Lumen\Application(
23 | realpath(__DIR__ . '/../')
24 | );
25 |
26 | $app->withFacades();
27 |
28 | $app->withEloquent();
29 |
30 | /**
31 | * Registering config files
32 | */
33 | $app->configure('services');
34 | $app->configure('auth');
35 |
36 | /*
37 | |--------------------------------------------------------------------------
38 | | Register Container Bindings
39 | |--------------------------------------------------------------------------
40 | |
41 | | Now we will register a few bindings in the service container. We will
42 | | register the exception handler and the console kernel. You may add
43 | | your own bindings here if you like or you can make another file.
44 | |
45 | */
46 |
47 | $app->singleton(
48 | Illuminate\Contracts\Debug\ExceptionHandler::class,
49 | App\Exceptions\Handler::class
50 | );
51 |
52 | $app->singleton(
53 | Illuminate\Contracts\Console\Kernel::class,
54 | App\Console\Kernel::class
55 | );
56 |
57 | /*
58 | |--------------------------------------------------------------------------
59 | | Register Middleware
60 | |--------------------------------------------------------------------------
61 | |
62 | | Next, we will register the middleware with the application. These can
63 | | be global middleware that run before and after each request into a
64 | | route or middleware that'll be assigned to some specific routes.
65 | |
66 | */
67 |
68 | // $app->middleware([
69 | // App\Http\Middleware\ExampleMiddleware::class
70 | // ]);
71 |
72 | $app->routeMiddleware([
73 | 'auth' => App\Http\Middleware\Authenticate::class,
74 | 'client.credentials' => Laravel\Passport\Http\Middleware\CheckClientCredentials::class,
75 | ]);
76 |
77 | /*
78 | |--------------------------------------------------------------------------
79 | | Register Service Providers
80 | |--------------------------------------------------------------------------
81 | |
82 | | Here we will register all of the application's service providers which
83 | | are used to bind services into the container. Service providers are
84 | | totally optional, so you are not required to uncomment this line.
85 | |
86 | */
87 |
88 | // $app->register(App\Providers\EventServiceProvider::class);
89 | // $app->register(App\Providers\AppServiceProvider::class);
90 | $app->register(App\Providers\AuthServiceProvider::class);
91 | $app->register(Laravel\Passport\PassportServiceProvider::class);
92 | $app->register(Dusterio\LumenPassport\PassportServiceProvider::class);
93 |
94 | /*
95 | |--------------------------------------------------------------------------
96 | | Load The Application Routes
97 | |--------------------------------------------------------------------------
98 | |
99 | | Next we will include the routes file so that they can all be added to
100 | | the application. This will provide all of the URLs the application
101 | | can respond to, as well as the controllers that may handle them.
102 | |
103 | */
104 |
105 | $app->router->group([
106 | 'namespace' => 'App\Http\Controllers',
107 | ], function ($router) {
108 | require __DIR__ . '/../routes/web.php';
109 | });
110 |
111 | return $app;
112 |
--------------------------------------------------------------------------------