Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.

Commit a259b13

Browse files
committed
Lots of cleanup, remove Laravel API Tools, Dingo and some tests.
1 parent c3ffc40 commit a259b13

35 files changed

+801
-2675
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ node_modules/
44
.gitignore
55
.DS_Store
66
.env
7+
vendor/
8+
storage/logs/laravel.log
9+
framework/cache/
10+
framework/sessions/
11+

Dockerfile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM joselfonsecadt/php7.0:1.0.0
1+
FROM joselfonsecadt/php7.0:1.1.0
22

33
MAINTAINER Jose Fonseca <[email protected]>
44

@@ -8,14 +8,23 @@ COPY docker/php-fpm.conf /etc/php/7.0/fpm/php-fpm.conf
88

99
COPY docker/www.conf /etc/php/7.0/fpm/pool.d/www.conf
1010

11-
COPY . /var/www/html/
12-
13-
EXPOSE 80
14-
1511
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
1612

1713
WORKDIR /var/www/html/
1814

15+
COPY composer.json ./
16+
17+
COPY composer.lock ./
18+
19+
RUN composer install --no-dev --no-scripts --no-autoloader
20+
21+
COPY . /var/www/html/
22+
23+
RUN composer dump-autoload --optimize && \
24+
php artisan optimize
25+
1926
RUN cp .env.example .env
2027

28+
EXPOSE 80
29+
2130
CMD ["/usr/bin/supervisord"]

app/Contracts/Users/UsersServiceContract.php

Lines changed: 0 additions & 50 deletions
This file was deleted.

app/Entities/Permission.php

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

33
namespace App\Entities;
44

5-
use Joselfonseca\LaravelApiTools\Traits\UuidScopeTrait;
5+
use App\Support\UuidScopeTrait;
66

77
/**
88
* Class Permission

app/Entities/Role.php

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

33
namespace App\Entities;
44

5-
use Joselfonseca\LaravelApiTools\Traits\UuidScopeTrait;
5+
use App\Support\UuidScopeTrait;
66

77
/**
88
* Class Role

app/Entities/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace App\Entities;
44

5+
use App\Support\UuidScopeTrait;
56
use Laravel\Passport\HasApiTokens;
67
use Spatie\Permission\Traits\HasRoles;
78
use Illuminate\Notifications\Notifiable;
89
use Illuminate\Database\Eloquent\SoftDeletes;
9-
use Joselfonseca\LaravelApiTools\Traits\UuidScopeTrait;
1010
use Illuminate\Foundation\Auth\User as Authenticatable;
1111

1212
class User extends Authenticatable
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Api\Users;
4+
5+
use App\Entities\User;
6+
use Illuminate\Http\Request;
7+
use App\Http\Controllers\Controller;
8+
use App\Transformers\Users\UserTransformer;
9+
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
10+
11+
/**
12+
* Class UsersController
13+
* @package App\Http\Controllers\Users
14+
*/
15+
class UsersController extends Controller
16+
{
17+
18+
protected $model;
19+
20+
public function __construct(User $model)
21+
{
22+
$this->model = $model;
23+
$this->middleware('permission:List users')->only('index');
24+
$this->middleware('permission:List users')->only('show');
25+
$this->middleware('permission:Create users')->only('store');
26+
$this->middleware('permission:Update users')->only('update');
27+
$this->middleware('permission:Delete users')->only('destroy');
28+
}
29+
30+
31+
/**
32+
* @param Request $request
33+
* @return mixed
34+
*/
35+
public function index(Request $request)
36+
{
37+
$paginator = $this->model->with('roles.permissions')
38+
->paginate($request->get('limit', env('PAGINATE_LIMIT', 20)));
39+
return fractal()->collection($paginator->getCollection(), new UserTransformer())
40+
->paginateWith(new IlluminatePaginatorAdapter($paginator))
41+
->respond();
42+
}
43+
44+
45+
/**
46+
* @param $id
47+
* @return mixed
48+
*/
49+
public function show($id)
50+
{
51+
52+
}
53+
54+
55+
/**
56+
* @param Request $request
57+
* @return mixed
58+
*/
59+
public function store(Request $request)
60+
{
61+
62+
}
63+
64+
65+
/**
66+
* @param Request $request
67+
* @param $uuid
68+
* @return mixed
69+
*/
70+
public function update(Request $request, $uuid)
71+
{
72+
73+
}
74+
75+
/**
76+
* @param Request $request
77+
* @param $uuid
78+
* @return mixed
79+
*/
80+
public function partialUpdate(Request $request, $uuid)
81+
{
82+
83+
}
84+
85+
86+
/**
87+
* @param Request $request
88+
* @param $uuids
89+
* @return mixed
90+
*/
91+
public function destroy(Request $request, $uuids)
92+
{
93+
94+
}
95+
}

app/Http/Controllers/Users/UsersController.php

Lines changed: 0 additions & 108 deletions
This file was deleted.

app/Providers/AppServiceProvider.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
namespace App\Providers;
44

5-
use App\Services\Users\UsersService;
65
use Illuminate\Support\ServiceProvider;
7-
use App\Contracts\Users\UsersServiceContract;
8-
use Illuminate\Database\Eloquent\ModelNotFoundException;
96

107
class AppServiceProvider extends ServiceProvider
118
{
@@ -26,9 +23,6 @@ public function boot()
2623
*/
2724
public function register()
2825
{
29-
$this->app->bind(UsersServiceContract::class, UsersService::class);
30-
app('Dingo\Api\Exception\Handler')->register(function (ModelNotFoundException $exception) {
31-
throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
32-
});
26+
3327
}
3428
}

app/Providers/AuthServiceProvider.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Carbon\Carbon;
66
use Laravel\Passport\Passport;
7-
use Joselfonseca\LaravelApiTools\Auth\PassportAuthenticationProvider;
87
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
98

109
class AuthServiceProvider extends ServiceProvider
@@ -29,8 +28,5 @@ public function boot()
2928
Passport::routes();
3029
Passport::tokensExpireIn(Carbon::now()->addHours(10));
3130
Passport::refreshTokensExpireIn(Carbon::now()->addDays(3));
32-
app('Dingo\Api\Auth\Auth')->extend('passport', function ($app) {
33-
return app(PassportAuthenticationProvider::class);
34-
});
3531
}
3632
}

0 commit comments

Comments
 (0)