Skip to content
This repository was archived by the owner on Apr 1, 2021. It is now read-only.

Commit 0f834ff

Browse files
committed
preset 404, json auth, update dep
1 parent 15399d5 commit 0f834ff

File tree

15 files changed

+499
-303
lines changed

15 files changed

+499
-303
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ PUSHER_APP_CLUSTER=mt1
3737

3838
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
3939
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
40+
41+
# API_URL=
42+
# API_USERNAME=
43+
# API_PASSWORD=

README.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,45 @@
44

55
> Laravel + CoreUI + Vue Boilerplate
66
7+
[![GitHub version](https://badge.fury.io/gh/adenvt%2Flaravel-coreui-vue.svg)](https://badge.fury.io/gh/adenvt%2Flaravel-coreui-vue)
8+
[![Greenkeeper badge](https://badges.greenkeeper.io/adenvt/laravel-coreui-vue.svg)](https://greenkeeper.io/)
9+
10+
## Requirement
11+
* **PHP** >= 7.1.3
12+
* OpenSSL PHP Extension
13+
* PDO PHP Extension
14+
* Mbstring PHP Extension
15+
* Tokenizer PHP Extension
16+
* XML PHP Extension
17+
* Ctype PHP Extension
18+
* JSON PHP Extension
19+
* **Node** >= 8.9.4
20+
* **NPM** >= 5.6.0
21+
* For Ubuntu, require `apt-get install libpng16-dev`, [see](https://github.com/imagemin/imagemin-mozjpeg/issues/28)
22+
723
## How to Install
8-
* Clone this repository
9-
* Install depencies
24+
* [Download][download] and extract this repository
25+
* Install all depencies
1026
```bash
11-
$ composer install
12-
$ npm install
27+
cd /path/to/folder
28+
29+
composer install
30+
npm install
1331
```
1432
* Copy `.env` file
1533
```bash
16-
$ cp -r .env.example .env
34+
cp -r .env.example .env
1735
```
1836
* Generate Application key
1937
```bash
20-
$ php artisan key:generate
38+
php artisan key:generate
2139
```
22-
* Add write permission
40+
* Add write permission (Unix)
2341
```bash
24-
$ chmod -R go+w storage bootstrap/cache
42+
chmod -R go+w storage bootstrap/cache
2543
```
2644

2745
## License
2846
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
47+
48+
[download]: https://github.com/adenvt/laravel-coreui-vue/archive/0.1.0.zip

app/Http/Kernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class Kernel extends HttpKernel
5151
* @var array
5252
*/
5353
protected $routeMiddleware = [
54+
// 'auth' => \App\Http\Middleware\Authenticate::class,
5455
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
5556
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
5657
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,

app/Http/Middleware/Authenticate.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace App\Http\Middleware;
4+
5+
use Closure;
6+
7+
class Authenticate
8+
{
9+
/**
10+
* Handle an incoming request.
11+
*
12+
* @param \Illuminate\Http\Request $request
13+
* @param \Closure $next
14+
* @return mixed
15+
*/
16+
public function handle($request, Closure $next)
17+
{
18+
if (!session()->has('auth') && !isset(session('auth')->access_token)) {
19+
$data = [
20+
'status' => 401,
21+
'success' => false,
22+
'message' => 'Token not provided',
23+
];
24+
25+
return response()->json($data, $data['status'], 401);
26+
}
27+
28+
return $next($request);
29+
}
30+
}

app/User.php renamed to app/Model/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace App;
3+
namespace App\Model;
44

55
use Illuminate\Notifications\Notifiable;
66
use Illuminate\Foundation\Auth\User as Authenticatable;

app/Providers/AppServiceProvider.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Providers;
44

5+
// use GuzzleHttp\Client;
56
use Illuminate\Support\ServiceProvider;
67

78
class AppServiceProvider extends ServiceProvider
@@ -23,6 +24,25 @@ public function boot()
2324
*/
2425
public function register()
2526
{
26-
//
27+
28+
// $this->app->singleton(Client::class, function ($app) {
29+
// $headers = [
30+
// 'Content-Type' => 'application/json',
31+
// 'Accept' => 'application/json',
32+
// ];
33+
34+
// if (session()->has('auth') && isset(session('auth')->access_token)) {
35+
// $headers['Authorization'] = 'Bearer ' . session('auth')->access_token;
36+
// }
37+
38+
// return new Client([
39+
// 'base_uri' => config('services.api.url'),
40+
// 'headers' => $headers,
41+
// 'auth' => [
42+
// config('services.api.username'),
43+
// config('services.api.password'),
44+
// ],
45+
// ]);
46+
// });
2747
}
2848
}

0 commit comments

Comments
 (0)