generator-folklore 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/generators/intl/index.js +93 -0
- package/lib/generators/laravel-mediatheque/index.js +133 -0
- package/lib/generators/laravel-mediatheque/templates/app/Models/Media.php +9 -0
- package/lib/generators/laravel-mediatheque/templates/app/Models/MediaFile.php +9 -0
- package/lib/generators/laravel-panneau/index.js +49 -28
- package/lib/generators/laravel-panneau/templates/app/Contracts/Repositories/Pages.php +19 -0
- package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Text.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Page.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Pages/Home.php +9 -0
- package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlockResource.php +37 -0
- package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlocksCollection.php +8 -0
- package/lib/generators/laravel-panneau/templates/app/Http/Resources/PageResource.php +47 -0
- package/lib/generators/laravel-panneau/templates/app/Http/Resources/PagesCollection.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Models/Block.php +3 -13
- package/lib/generators/laravel-panneau/templates/app/Models/Page.php +3 -60
- package/lib/generators/laravel-panneau/templates/app/Panneau/Composers/AppComposer.php +50 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Block.php +22 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Blocks.php +87 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Page.php +51 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlug.php +34 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlugLocalized.php +18 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/AccountController.php +41 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/Controller.php +19 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/HomeController.php +16 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/PagesController.php +24 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UploadController.php +27 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UsersController.php +32 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/AccountUpdateRequest.php +29 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/UploadRequest.php +29 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlockResource.php +39 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlocksCollection.php +8 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PageResource.php +56 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PagesCollection.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/UserResource.php +24 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/PanneauServiceProvider.php +48 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Policies/PanneauPolicy.php +32 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/BlockWithBlocks.php +110 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/TextBlock.php +27 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks.php +42 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages/Page.php +28 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages.php +92 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Users.php +57 -0
- package/lib/generators/laravel-panneau/templates/app/Repositories/Pages.php +42 -0
- package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/TextBlock.php +14 -0
- package/lib/generators/laravel-panneau/templates/app/Resources/Page.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Resources/Pages/HomePage.php +10 -0
- package/lib/generators/laravel-panneau/templates/app.blade.php +8 -0
- package/lib/generators/laravel-panneau/templates/index.js +32 -0
- package/lib/generators/laravel-panneau/templates/lang/en/panneau.php +62 -0
- package/lib/generators/laravel-panneau/templates/lang/fr/panneau.php +62 -0
- package/lib/generators/laravel-panneau/templates/layout.blade.php +17 -48
- package/lib/generators/laravel-panneau/templates/resources/assets/js/components/Panneau.jsx +68 -0
- package/lib/generators/laravel-panneau/templates/{app/Schemas/Fields/.gitkeep → resources/assets/js/components/panneau/fields/PageSlug.jsx} +0 -0
- package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlugLocalized.jsx +43 -0
- package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/index.js +2 -0
- package/lib/generators/laravel-panneau/templates/resources/assets/styles/panneau.scss +2 -0
- package/lib/generators/laravel-panneau/templates/routes.php +30 -0
- package/lib/generators/laravel-project/index.js +504 -0
- package/lib/generators/laravel-project/templates/env +41 -0
- package/lib/generators/laravel-project/templates/laravel/app/Composers/AppComposer.php +48 -0
- package/lib/generators/laravel-project/templates/laravel/app/Composers/IntlComposer.php +10 -0
- package/lib/generators/laravel-project/templates/laravel/app/Composers/MetaComposer.php +48 -0
- package/lib/generators/laravel-project/templates/laravel/app/Composers/RoutesComposer.php +19 -0
- package/lib/generators/laravel-project/templates/laravel/app/Contracts/Resources/User.php +10 -0
- package/lib/generators/laravel-project/templates/laravel/app/Http/Controllers/HomeController.php +18 -0
- package/lib/generators/laravel-project/templates/laravel/app/Http/Middleware/TrustProxies.php +28 -0
- package/lib/generators/laravel-project/templates/laravel/app/Http/Resources/UserResource.php +21 -0
- package/lib/generators/laravel-project/templates/laravel/app/Models/User.php +50 -0
- package/lib/generators/laravel-project/templates/laravel/app/Providers/AppServiceProvider.php +45 -0
- package/lib/generators/laravel-project/templates/laravel/app/Providers/RouteServiceProvider.php +64 -0
- package/lib/generators/laravel-project/templates/laravel/app/Providers/ViewServiceProvider.php +33 -0
- package/lib/generators/laravel-project/templates/laravel/app/Repositories/Users.php +36 -0
- package/lib/generators/laravel-project/templates/laravel/app/Resources/User.php +11 -0
- package/lib/generators/laravel-project/templates/laravel/config/app.php +216 -0
- package/lib/generators/laravel-project/templates/laravel/config/auth.php +116 -0
- package/lib/generators/laravel-project/templates/laravel/config/services.php +39 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/content.php +5 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/errors.php +17 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/meta.php +11 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/routes.php +4 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/auth.php +19 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/content.php +5 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/errors.php +17 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/meta.php +11 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/pagination.php +19 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/passwords.php +22 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/routes.php +12 -0
- package/lib/generators/laravel-project/templates/laravel/lang/fr/validation.php +146 -0
- package/lib/generators/laravel-project/templates/laravel/resources/assets/fonts/.gitkeep +0 -0
- package/lib/generators/laravel-project/templates/laravel/resources/assets/img/.gitkeep +0 -0
- package/lib/generators/laravel-project/templates/laravel/resources/assets/img/folklore.png +0 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/body.blade.php +3 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/gpt.blade.php +16 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/head.blade.php +1 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/app.blade.php +8 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/errors/401.blade.php +8 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/errors/403.blade.php +8 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/errors/404.blade.php +8 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/errors/500.blade.php +8 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/layout.blade.php +33 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/meta/all.blade.php +4 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/meta/base.blade.php +11 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/meta/facebook.blade.php +4 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/meta/opengraph.blade.php +9 -0
- package/lib/generators/laravel-project/templates/laravel/resources/views/meta/twitter.blade.php +5 -0
- package/lib/generators/laravel-project/templates/laravel/routes/web.php +12 -0
- package/lib/generators/react-app/templates/src/components/App.jsx +3 -2
- package/lib/generators/react-app/templates/src/components/pages/Error.jsx +2 -2
- package/lib/lib/generator.js +9 -0
- package/package.json +2 -2
- package/lib/generators/laravel-panneau/templates/_composer.json +0 -6
- package/lib/generators/laravel-panneau/templates/_package.json +0 -11
- package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/HomeController.php +0 -14
- package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/PagesController.php +0 -11
- package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/File.php +0 -13
- package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Picture.php +0 -13
- package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Video.php +0 -34
- package/lib/generators/laravel-panneau/templates/app/Providers/PanneauServiceProvider.php +0 -23
- package/lib/generators/laravel-panneau/templates/app/Reducers/SlugExtractReducer.php +0 -18
- package/lib/generators/laravel-panneau/templates/app/Resources/Pages.php +0 -54
- package/lib/generators/laravel-panneau/templates/app/Schemas/Blocks/Base.php +0 -22
- package/lib/generators/laravel-panneau/templates/app/Schemas/Bubbles/Base.php +0 -22
- package/lib/generators/laravel-panneau/templates/app/Schemas/Pages/Base.php +0 -36
- package/lib/generators/laravel-panneau/templates/resources/lang/en/panneau.php +0 -12
- package/lib/generators/laravel-panneau/templates/resources/lang/fr/panneau.php +0 -12
@@ -0,0 +1,48 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Composers;
|
4
|
+
|
5
|
+
use Illuminate\Http\Request;
|
6
|
+
use Illuminate\View\View;
|
7
|
+
use App\Http\Resources\UserResource;
|
8
|
+
|
9
|
+
class AppComposer
|
10
|
+
{
|
11
|
+
|
12
|
+
/**
|
13
|
+
* The request
|
14
|
+
*
|
15
|
+
* @var \Illuminate\Http\Request
|
16
|
+
*/
|
17
|
+
protected $request;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Create a new profile composer.
|
21
|
+
*
|
22
|
+
* @param \Illuminate\Http\Request $request
|
23
|
+
* @return void
|
24
|
+
*/
|
25
|
+
public function __construct(Request $request)
|
26
|
+
{
|
27
|
+
$this->request = $request;
|
28
|
+
}
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Bind data to the view.
|
32
|
+
*
|
33
|
+
* @param View $view
|
34
|
+
* @return void
|
35
|
+
*/
|
36
|
+
public function compose(View $view)
|
37
|
+
{
|
38
|
+
$site = $this->request->site();
|
39
|
+
$user = $this->request->user();
|
40
|
+
|
41
|
+
$view->props = [
|
42
|
+
'routes' => $view->routes,
|
43
|
+
'intl' => $view->intl,
|
44
|
+
'user' => !is_null($user) ? new UserResource($user) : null,
|
45
|
+
'site' => $site,
|
46
|
+
];
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Composers;
|
4
|
+
|
5
|
+
use Illuminate\Http\Request;
|
6
|
+
use Illuminate\View\View;
|
7
|
+
use Illuminate\Http\Resources\Json\JsonResource;
|
8
|
+
|
9
|
+
class MetaComposer
|
10
|
+
{
|
11
|
+
/**
|
12
|
+
* The request
|
13
|
+
*
|
14
|
+
* @var \Illuminate\Http\Request
|
15
|
+
*/
|
16
|
+
protected $request;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Create a new profile composer.
|
20
|
+
*
|
21
|
+
* @param \Illuminate\Http\Request $request
|
22
|
+
* @return void
|
23
|
+
*/
|
24
|
+
public function __construct(Request $request)
|
25
|
+
{
|
26
|
+
$this->request = $request;
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Bind data to the view.
|
31
|
+
*
|
32
|
+
* @param View $view
|
33
|
+
* @return void
|
34
|
+
*/
|
35
|
+
public function compose(View $view)
|
36
|
+
{
|
37
|
+
$locale = $this->request->locale();
|
38
|
+
$view->title = trans('meta.title');
|
39
|
+
$view->description = trans('meta.description');
|
40
|
+
$view->image = asset(trans('meta.image'));
|
41
|
+
$view->url = $this->request->url();
|
42
|
+
$view->canonical = $this->request->url();
|
43
|
+
$view->siteName = trans('meta.siteName');
|
44
|
+
$view->appId = config('services.facebook.client_id');
|
45
|
+
|
46
|
+
$page = $view->page instanceof JsonResource ? $view->page->resource : $view->page;
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Composers;
|
4
|
+
|
5
|
+
use Illuminate\View\View;
|
6
|
+
use Illuminate\Http\Request;
|
7
|
+
use Illuminate\Routing\Router;
|
8
|
+
use Folklore\Composers\RoutesComposer as BaseRoutesComposer;
|
9
|
+
|
10
|
+
class RoutesComposer extends BaseRoutesComposer
|
11
|
+
{
|
12
|
+
protected $routes = [];
|
13
|
+
|
14
|
+
protected $routesLocalized = [
|
15
|
+
'home',
|
16
|
+
];
|
17
|
+
|
18
|
+
protected $withoutParametersPatterns = true;
|
19
|
+
}
|
package/lib/generators/laravel-project/templates/laravel/app/Http/Controllers/HomeController.php
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Http\Controllers;
|
4
|
+
|
5
|
+
use Illuminate\Http\Request;
|
6
|
+
|
7
|
+
class HomeController extends Controller
|
8
|
+
{
|
9
|
+
public function index(Request $request)
|
10
|
+
{
|
11
|
+
return view('app');
|
12
|
+
}
|
13
|
+
|
14
|
+
public function redirect(Request $request)
|
15
|
+
{
|
16
|
+
return redirect()->to(app('url')->routeWithLocale('home'));
|
17
|
+
}
|
18
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Http\Middleware;
|
4
|
+
|
5
|
+
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
6
|
+
use Illuminate\Http\Request;
|
7
|
+
|
8
|
+
class TrustProxies extends Middleware
|
9
|
+
{
|
10
|
+
/**
|
11
|
+
* The trusted proxies for this application.
|
12
|
+
*
|
13
|
+
* @var array<int, string>|string|null
|
14
|
+
*/
|
15
|
+
protected $proxies = '*';
|
16
|
+
|
17
|
+
/**
|
18
|
+
* The headers that should be used to detect proxies.
|
19
|
+
*
|
20
|
+
* @var int
|
21
|
+
*/
|
22
|
+
protected $headers =
|
23
|
+
Request::HEADER_X_FORWARDED_FOR |
|
24
|
+
Request::HEADER_X_FORWARDED_HOST |
|
25
|
+
Request::HEADER_X_FORWARDED_PORT |
|
26
|
+
Request::HEADER_X_FORWARDED_PROTO |
|
27
|
+
Request::HEADER_X_FORWARDED_AWS_ELB;
|
28
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Http\Resources;
|
4
|
+
|
5
|
+
use Illuminate\Http\Resources\Json\JsonResource;
|
6
|
+
|
7
|
+
class UserResource extends JsonResource
|
8
|
+
{
|
9
|
+
/**
|
10
|
+
* Transform the resource into an array.
|
11
|
+
*
|
12
|
+
* @param \Illuminate\Http\Request $request
|
13
|
+
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
14
|
+
*/
|
15
|
+
public function toArray($request)
|
16
|
+
{
|
17
|
+
return [
|
18
|
+
'id' => $this->id(),
|
19
|
+
];
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Models;
|
4
|
+
|
5
|
+
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
6
|
+
use Folklore\Models\User as BaseUser;
|
7
|
+
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
8
|
+
use Laravel\Sanctum\HasApiTokens;
|
9
|
+
use App\Contracts\Resources\User as UserContract;
|
10
|
+
use App\Resources\User as UserResource;
|
11
|
+
|
12
|
+
class User extends BaseUser
|
13
|
+
{
|
14
|
+
use HasApiTokens, HasFactory;
|
15
|
+
|
16
|
+
/**
|
17
|
+
* The attributes that are mass assignable.
|
18
|
+
*
|
19
|
+
* @var array<int, string>
|
20
|
+
*/
|
21
|
+
protected $fillable = [
|
22
|
+
'name',
|
23
|
+
'email',
|
24
|
+
'password',
|
25
|
+
];
|
26
|
+
|
27
|
+
/**
|
28
|
+
* The attributes that should be hidden for serialization.
|
29
|
+
*
|
30
|
+
* @var array<int, string>
|
31
|
+
*/
|
32
|
+
protected $hidden = [
|
33
|
+
'password',
|
34
|
+
'remember_token',
|
35
|
+
];
|
36
|
+
|
37
|
+
/**
|
38
|
+
* The attributes that should be cast.
|
39
|
+
*
|
40
|
+
* @var array<string, string>
|
41
|
+
*/
|
42
|
+
protected $casts = [
|
43
|
+
'email_verified_at' => 'datetime',
|
44
|
+
];
|
45
|
+
|
46
|
+
public function toResource(): UserContract
|
47
|
+
{
|
48
|
+
return new UserResource($this);
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Providers;
|
4
|
+
|
5
|
+
use Illuminate\Support\ServiceProvider;
|
6
|
+
use Illuminate\Support\Facades\Schema;
|
7
|
+
use Illuminate\Http\Resources\Json\JsonResource;
|
8
|
+
use Illuminate\Http\Request;
|
9
|
+
|
10
|
+
class AppServiceProvider extends ServiceProvider
|
11
|
+
{
|
12
|
+
/**
|
13
|
+
* Bootstrap any application services.
|
14
|
+
*
|
15
|
+
* @return void
|
16
|
+
*/
|
17
|
+
public function boot()
|
18
|
+
{
|
19
|
+
Schema::defaultStringLength(191);
|
20
|
+
JsonResource::withoutWrapping();
|
21
|
+
|
22
|
+
// Determine site from request
|
23
|
+
Request::macro('site', function () {
|
24
|
+
return null;
|
25
|
+
});
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Register any application services.
|
30
|
+
*
|
31
|
+
* @return void
|
32
|
+
*/
|
33
|
+
public function register()
|
34
|
+
{
|
35
|
+
$this->registerRepositories();
|
36
|
+
}
|
37
|
+
|
38
|
+
protected function registerRepositories()
|
39
|
+
{
|
40
|
+
$this->app->bind(
|
41
|
+
\Folklore\Contracts\Repositories\Users::class,
|
42
|
+
\App\Repositories\Users::class
|
43
|
+
);
|
44
|
+
}
|
45
|
+
}
|
package/lib/generators/laravel-project/templates/laravel/app/Providers/RouteServiceProvider.php
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Providers;
|
4
|
+
|
5
|
+
use Illuminate\Cache\RateLimiting\Limit;
|
6
|
+
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
7
|
+
use Illuminate\Http\Request;
|
8
|
+
use Illuminate\Support\Facades\RateLimiter;
|
9
|
+
use Illuminate\Support\Facades\Route;
|
10
|
+
|
11
|
+
class RouteServiceProvider extends ServiceProvider
|
12
|
+
{
|
13
|
+
/**
|
14
|
+
* The path to the "home" route for your application.
|
15
|
+
*
|
16
|
+
* Typically, users are redirected here after authentication.
|
17
|
+
*
|
18
|
+
* @var string
|
19
|
+
*/
|
20
|
+
public const HOME = '/home';
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Define your route model bindings, pattern filters, and other route configuration.
|
24
|
+
*
|
25
|
+
* @return void
|
26
|
+
*/
|
27
|
+
public function boot()
|
28
|
+
{
|
29
|
+
$this->configureRateLimiting();
|
30
|
+
|
31
|
+
$this->bootPatterns();
|
32
|
+
|
33
|
+
$this->bootBindings();
|
34
|
+
|
35
|
+
$this->routes(function () {
|
36
|
+
Route::middleware('api')
|
37
|
+
->prefix('api')
|
38
|
+
->group(base_path('routes/api.php'));
|
39
|
+
|
40
|
+
Route::middleware('web')
|
41
|
+
->group(base_path('routes/web.php'));
|
42
|
+
});
|
43
|
+
}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Configure the rate limiters for the application.
|
47
|
+
*
|
48
|
+
* @return void
|
49
|
+
*/
|
50
|
+
protected function configureRateLimiting()
|
51
|
+
{
|
52
|
+
RateLimiter::for('api', function (Request $request) {
|
53
|
+
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
54
|
+
});
|
55
|
+
}
|
56
|
+
|
57
|
+
protected function bootPatterns()
|
58
|
+
{
|
59
|
+
}
|
60
|
+
|
61
|
+
protected function bootBindings()
|
62
|
+
{
|
63
|
+
}
|
64
|
+
}
|
package/lib/generators/laravel-project/templates/laravel/app/Providers/ViewServiceProvider.php
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Providers;
|
4
|
+
|
5
|
+
use Illuminate\Support\ServiceProvider;
|
6
|
+
use Illuminate\Contracts\View\Factory as ViewFactory;
|
7
|
+
|
8
|
+
class ViewServiceProvider extends ServiceProvider
|
9
|
+
{
|
10
|
+
/**
|
11
|
+
* Register any application services.
|
12
|
+
*
|
13
|
+
* @return void
|
14
|
+
*/
|
15
|
+
public function register()
|
16
|
+
{
|
17
|
+
//
|
18
|
+
}
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Bootstrap any application services.
|
22
|
+
*
|
23
|
+
* @return void
|
24
|
+
*/
|
25
|
+
public function boot()
|
26
|
+
{
|
27
|
+
$view = $this->app[ViewFactory::class];
|
28
|
+
$view->composer('app', \App\Composers\IntlComposer::class);
|
29
|
+
$view->composer('app', \App\Composers\RoutesComposer::class);
|
30
|
+
$view->composer('app', \App\Composers\AppComposer::class);
|
31
|
+
$view->composer('meta.*', \App\Composers\MetaComposer::class);
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Repositories;
|
4
|
+
|
5
|
+
use Folklore\Repositories\Users as BaseUsers;
|
6
|
+
use Illuminate\Database\Eloquent\Model;
|
7
|
+
use App\Models\User as UserModel;
|
8
|
+
use App\Contracts\Resources\User as UserContract;
|
9
|
+
|
10
|
+
class Users extends BaseUsers
|
11
|
+
{
|
12
|
+
protected function newModel(): Model
|
13
|
+
{
|
14
|
+
return new UserModel();
|
15
|
+
}
|
16
|
+
|
17
|
+
public function findById(string $id): ?UserContract
|
18
|
+
{
|
19
|
+
return parent::findById($id);
|
20
|
+
}
|
21
|
+
|
22
|
+
public function findByEmail(string $email): ?UserContract
|
23
|
+
{
|
24
|
+
return parent::findByEmail($email);
|
25
|
+
}
|
26
|
+
|
27
|
+
public function create(array $data): UserContract
|
28
|
+
{
|
29
|
+
return parent::create($data);
|
30
|
+
}
|
31
|
+
|
32
|
+
public function update(string $id, array $data): ?UserContract
|
33
|
+
{
|
34
|
+
return parent::update($id, $data);
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,216 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
use Illuminate\Support\Facades\Facade;
|
4
|
+
|
5
|
+
return [
|
6
|
+
|
7
|
+
/*
|
8
|
+
|--------------------------------------------------------------------------
|
9
|
+
| Application Name
|
10
|
+
|--------------------------------------------------------------------------
|
11
|
+
|
|
12
|
+
| This value is the name of your application. This value is used when the
|
13
|
+
| framework needs to place the application's name in a notification or
|
14
|
+
| any other location as required by the application or its packages.
|
15
|
+
|
|
16
|
+
*/
|
17
|
+
|
18
|
+
'name' => env('APP_NAME', '<%= options.project_name %>'),
|
19
|
+
|
20
|
+
/*
|
21
|
+
|--------------------------------------------------------------------------
|
22
|
+
| Application Environment
|
23
|
+
|--------------------------------------------------------------------------
|
24
|
+
|
|
25
|
+
| This value determines the "environment" your application is currently
|
26
|
+
| running in. This may determine how you prefer to configure various
|
27
|
+
| services the application utilizes. Set this in your ".env" file.
|
28
|
+
|
|
29
|
+
*/
|
30
|
+
|
31
|
+
'env' => env('APP_ENV', 'production'),
|
32
|
+
|
33
|
+
/*
|
34
|
+
|--------------------------------------------------------------------------
|
35
|
+
| Application Debug Mode
|
36
|
+
|--------------------------------------------------------------------------
|
37
|
+
|
|
38
|
+
| When your application is in debug mode, detailed error messages with
|
39
|
+
| stack traces will be shown on every error that occurs within your
|
40
|
+
| application. If disabled, a simple generic error page is shown.
|
41
|
+
|
|
42
|
+
*/
|
43
|
+
|
44
|
+
'debug' => (bool) env('APP_DEBUG', false),
|
45
|
+
|
46
|
+
/*
|
47
|
+
|--------------------------------------------------------------------------
|
48
|
+
| Application URL
|
49
|
+
|--------------------------------------------------------------------------
|
50
|
+
|
|
51
|
+
| This URL is used by the console to properly generate URLs when using
|
52
|
+
| the Artisan command line tool. You should set this to the root of
|
53
|
+
| your application so that it is used when running Artisan tasks.
|
54
|
+
|
|
55
|
+
*/
|
56
|
+
|
57
|
+
'url' => env('APP_URL', '<%= options.project_url %>'),
|
58
|
+
|
59
|
+
'asset_url' => env('ASSET_URL'),
|
60
|
+
|
61
|
+
/*
|
62
|
+
|--------------------------------------------------------------------------
|
63
|
+
| Application Timezone
|
64
|
+
|--------------------------------------------------------------------------
|
65
|
+
|
|
66
|
+
| Here you may specify the default timezone for your application, which
|
67
|
+
| will be used by the PHP date and date-time functions. We have gone
|
68
|
+
| ahead and set this to a sensible default for you out of the box.
|
69
|
+
|
|
70
|
+
*/
|
71
|
+
|
72
|
+
'timezone' => 'America/Montreal',
|
73
|
+
|
74
|
+
/*
|
75
|
+
|--------------------------------------------------------------------------
|
76
|
+
| Application Locale Configuration
|
77
|
+
|--------------------------------------------------------------------------
|
78
|
+
|
|
79
|
+
| The application locale determines the default locale that will be used
|
80
|
+
| by the translation service provider. You are free to set this value
|
81
|
+
| to any of the locales which will be supported by the application.
|
82
|
+
|
|
83
|
+
*/
|
84
|
+
|
85
|
+
'locale' => 'en',
|
86
|
+
|
87
|
+
/*
|
88
|
+
|--------------------------------------------------------------------------
|
89
|
+
| Application Fallback Locale
|
90
|
+
|--------------------------------------------------------------------------
|
91
|
+
|
|
92
|
+
| The fallback locale determines the locale to use when the current one
|
93
|
+
| is not available. You may change the value to correspond to any of
|
94
|
+
| the language folders that are provided through your application.
|
95
|
+
|
|
96
|
+
*/
|
97
|
+
|
98
|
+
'fallback_locale' => 'en',
|
99
|
+
|
100
|
+
/*
|
101
|
+
|--------------------------------------------------------------------------
|
102
|
+
| Faker Locale
|
103
|
+
|--------------------------------------------------------------------------
|
104
|
+
|
|
105
|
+
| This locale will be used by the Faker PHP library when generating fake
|
106
|
+
| data for your database seeds. For example, this will be used to get
|
107
|
+
| localized telephone numbers, street address information and more.
|
108
|
+
|
|
109
|
+
*/
|
110
|
+
|
111
|
+
'faker_locale' => 'en_US',
|
112
|
+
|
113
|
+
/*
|
114
|
+
|--------------------------------------------------------------------------
|
115
|
+
| Encryption Key
|
116
|
+
|--------------------------------------------------------------------------
|
117
|
+
|
|
118
|
+
| This key is used by the Illuminate encrypter service and should be set
|
119
|
+
| to a random, 32 character string, otherwise these encrypted strings
|
120
|
+
| will not be safe. Please do this before deploying an application!
|
121
|
+
|
|
122
|
+
*/
|
123
|
+
|
124
|
+
'key' => env('APP_KEY'),
|
125
|
+
|
126
|
+
'cipher' => 'AES-256-CBC',
|
127
|
+
|
128
|
+
/*
|
129
|
+
|--------------------------------------------------------------------------
|
130
|
+
| Maintenance Mode Driver
|
131
|
+
|--------------------------------------------------------------------------
|
132
|
+
|
|
133
|
+
| These configuration options determine the driver used to determine and
|
134
|
+
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
135
|
+
| allow maintenance mode to be controlled across multiple machines.
|
136
|
+
|
|
137
|
+
| Supported drivers: "file", "cache"
|
138
|
+
|
|
139
|
+
*/
|
140
|
+
|
141
|
+
'maintenance' => [
|
142
|
+
'driver' => 'file',
|
143
|
+
// 'store' => 'redis',
|
144
|
+
],
|
145
|
+
|
146
|
+
/*
|
147
|
+
|--------------------------------------------------------------------------
|
148
|
+
| Autoloaded Service Providers
|
149
|
+
|--------------------------------------------------------------------------
|
150
|
+
|
|
151
|
+
| The service providers listed here will be automatically loaded on the
|
152
|
+
| request to your application. Feel free to add your own services to
|
153
|
+
| this array to grant expanded functionality to your applications.
|
154
|
+
|
|
155
|
+
*/
|
156
|
+
|
157
|
+
'providers' => [
|
158
|
+
|
159
|
+
/*
|
160
|
+
* Laravel Framework Service Providers...
|
161
|
+
*/
|
162
|
+
Illuminate\Auth\AuthServiceProvider::class,
|
163
|
+
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
164
|
+
Illuminate\Bus\BusServiceProvider::class,
|
165
|
+
Illuminate\Cache\CacheServiceProvider::class,
|
166
|
+
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
167
|
+
Illuminate\Cookie\CookieServiceProvider::class,
|
168
|
+
Illuminate\Database\DatabaseServiceProvider::class,
|
169
|
+
Illuminate\Encryption\EncryptionServiceProvider::class,
|
170
|
+
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
171
|
+
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
172
|
+
Illuminate\Hashing\HashServiceProvider::class,
|
173
|
+
Illuminate\Mail\MailServiceProvider::class,
|
174
|
+
Illuminate\Notifications\NotificationServiceProvider::class,
|
175
|
+
Illuminate\Pagination\PaginationServiceProvider::class,
|
176
|
+
Illuminate\Pipeline\PipelineServiceProvider::class,
|
177
|
+
Illuminate\Queue\QueueServiceProvider::class,
|
178
|
+
Illuminate\Redis\RedisServiceProvider::class,
|
179
|
+
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
180
|
+
Illuminate\Session\SessionServiceProvider::class,
|
181
|
+
Illuminate\Translation\TranslationServiceProvider::class,
|
182
|
+
Illuminate\Validation\ValidationServiceProvider::class,
|
183
|
+
Illuminate\View\ViewServiceProvider::class,
|
184
|
+
|
185
|
+
/*
|
186
|
+
* Package Service Providers...
|
187
|
+
*/
|
188
|
+
|
189
|
+
/*
|
190
|
+
* Application Service Providers...
|
191
|
+
*/
|
192
|
+
App\Providers\AppServiceProvider::class,
|
193
|
+
App\Providers\AuthServiceProvider::class,
|
194
|
+
// App\Providers\BroadcastServiceProvider::class,
|
195
|
+
App\Providers\EventServiceProvider::class,
|
196
|
+
App\Providers\RouteServiceProvider::class,
|
197
|
+
App\Providers\ViewServiceProvider::class,
|
198
|
+
|
199
|
+
],
|
200
|
+
|
201
|
+
/*
|
202
|
+
|--------------------------------------------------------------------------
|
203
|
+
| Class Aliases
|
204
|
+
|--------------------------------------------------------------------------
|
205
|
+
|
|
206
|
+
| This array of class aliases will be registered when this application
|
207
|
+
| is started. However, feel free to register as many as you wish as
|
208
|
+
| the aliases are "lazy" loaded so they don't hinder performance.
|
209
|
+
|
|
210
|
+
*/
|
211
|
+
|
212
|
+
'aliases' => Facade::defaultAliases()->merge([
|
213
|
+
// 'ExampleClass' => App\Example\ExampleClass::class,
|
214
|
+
])->toArray(),
|
215
|
+
|
216
|
+
];
|