generator-folklore 3.0.3 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/generators/app/index.js +3 -51
- package/lib/generators/babel/index.js +28 -101
- package/lib/generators/babel/templates/config.js +16 -0
- package/lib/generators/browserslist/index.js +4 -9
- package/lib/generators/build/index.js +40 -29
- package/lib/generators/cli/index.js +92 -0
- package/lib/generators/cli/templates/cli.js +22 -0
- package/lib/generators/cli/templates/commands/default.js +16 -0
- package/lib/generators/docs/index.js +1 -2
- package/lib/generators/editorconfig/index.js +12 -22
- package/lib/generators/eslint/index.js +12 -13
- package/lib/generators/{html → html-project}/index.js +60 -73
- package/lib/generators/{html → html-project}/templates/folklore.png +0 -0
- package/lib/generators/{html → html-project}/templates/gitignore +0 -0
- package/lib/generators/{html → html-project}/templates/index.html.ejs +4 -1
- package/lib/generators/intl/index.js +93 -0
- package/lib/generators/laravel/index.js +5 -5
- 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/{js/templates/src/lib/.gitkeep → laravel-panneau/templates/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/{js/templates/styles → laravel-project/templates/laravel/resources/assets/fonts}/.gitkeep +0 -0
- package/lib/generators/{laravel-panneau/templates/app/Schemas/Fields → 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/lerna-package/index.js +1 -3
- package/lib/generators/lerna-repository/index.js +1 -3
- package/lib/generators/node-project/index.js +164 -0
- package/lib/generators/node-project/templates/index.js +0 -0
- package/lib/generators/npm-package/index.js +3 -5
- package/lib/generators/prettier/index.js +19 -6
- package/lib/generators/prettier/templates/prettierrc.json +3 -1
- package/lib/generators/{js → react-app}/index.js +22 -52
- package/lib/generators/{js → react-app}/templates/_package.json +0 -0
- package/lib/generators/react-app/templates/index.js +23 -0
- package/lib/generators/react-app/templates/src/components/App.jsx +46 -0
- package/lib/generators/react-app/templates/src/components/Container.jsx +40 -0
- package/lib/generators/{js → react-app}/templates/src/components/buttons/Button.jsx +4 -18
- package/lib/generators/react-app/templates/src/components/layouts/Main.jsx +27 -0
- package/lib/generators/react-app/templates/src/components/menus/Menu.jsx +62 -0
- package/lib/generators/{js → react-app}/templates/src/components/pages/Error.jsx +10 -14
- package/lib/generators/react-app/templates/src/components/pages/Home.jsx +32 -0
- package/lib/generators/{js → react-app}/templates/src/components/partials/PageMeta.jsx +11 -11
- package/lib/generators/{js → react-app}/templates/src/contexts/KeysContext.jsx +0 -0
- package/lib/generators/react-app/templates/src/lib/.gitkeep +0 -0
- package/lib/generators/{js → react-app}/templates/src/lib/PropTypes.js +0 -0
- package/lib/generators/{js → react-app}/templates/src/lib/utils.js +0 -0
- package/lib/generators/react-app/templates/src/polyfills/index.js +6 -0
- package/lib/generators/react-app/templates/src/polyfills/intl-en.js +2 -0
- package/lib/generators/react-app/templates/src/polyfills/intl-fr.js +2 -0
- package/lib/generators/react-app/templates/src/polyfills/should.js +14 -0
- package/lib/generators/react-app/templates/styles/.gitkeep +0 -0
- package/lib/generators/{js/templates/styles/buttons/button.scss → react-app/templates/styles/buttons/button.module.scss} +1 -0
- package/lib/generators/{js/templates/styles/layouts/main.scss → react-app/templates/styles/layouts/main.module.scss} +0 -0
- package/lib/generators/{js/templates/styles/menus/menu.scss → react-app/templates/styles/menus/menu.module.scss} +0 -0
- package/lib/generators/{js/templates/styles/pages/error.scss → react-app/templates/styles/pages/error.module.scss} +0 -0
- package/lib/generators/{js/templates/styles/pages/home.scss → react-app/templates/styles/pages/home.module.scss} +0 -0
- package/lib/generators/rollup/index.js +54 -0
- package/lib/generators/rollup/templates/config.js +50 -0
- package/lib/generators/scss/index.js +3 -16
- package/lib/generators/scss/templates/{main.scss → styles.scss} +0 -0
- package/lib/generators/server/index.js +81 -0
- package/lib/generators/server/templates/server.js +59 -0
- package/lib/generators/storybook/index.js +1 -7
- package/lib/generators/stylelint/index.js +13 -14
- package/lib/lib/generator.js +9 -0
- package/lib/lib/utils.js +17 -0
- package/package.json +2 -2
- package/lib/generators/babel/templates/babel-preset-react.js +0 -7
- package/lib/generators/babel/templates/babel-preset.js +0 -57
- package/lib/generators/babel/templates/babelrc +0 -5
- package/lib/generators/babel/templates/utils/processScss.js +0 -10
- package/lib/generators/babel/templates/utils/transformRequireIgnore.js +0 -80
- package/lib/generators/html/templates/index.js +0 -9
- package/lib/generators/html/templates/root.js +0 -23
- package/lib/generators/html/templates/utils.js +0 -7
- package/lib/generators/js/templates/browserslistrc +0 -9
- package/lib/generators/js/templates/config.js +0 -33
- package/lib/generators/js/templates/index.js +0 -41
- package/lib/generators/js/templates/src/actions/LayoutActions.js +0 -12
- package/lib/generators/js/templates/src/actions/SiteActions.js +0 -22
- package/lib/generators/js/templates/src/components/App.jsx +0 -52
- package/lib/generators/js/templates/src/components/Root.jsx +0 -70
- package/lib/generators/js/templates/src/components/layouts/Main.jsx +0 -52
- package/lib/generators/js/templates/src/components/menus/Menu.jsx +0 -60
- package/lib/generators/js/templates/src/components/messages/Success.jsx +0 -36
- package/lib/generators/js/templates/src/components/pages/Home.jsx +0 -32
- package/lib/generators/js/templates/src/components/partials/Label.jsx +0 -32
- package/lib/generators/js/templates/src/reducers/LayoutReducer.js +0 -32
- package/lib/generators/js/templates/src/reducers/SiteReducer.js +0 -36
- package/lib/generators/js/templates/src/reducers/index.js +0 -7
- package/lib/generators/js/templates/src/vendor/polyfills/intl-en.js +0 -2
- package/lib/generators/js/templates/src/vendor/polyfills/intl-fr.js +0 -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,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
|
+
];
|
@@ -0,0 +1,116 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
return [
|
4
|
+
|
5
|
+
/*
|
6
|
+
|--------------------------------------------------------------------------
|
7
|
+
| Authentication Defaults
|
8
|
+
|--------------------------------------------------------------------------
|
9
|
+
|
|
10
|
+
| This option controls the default authentication "guard" and password
|
11
|
+
| reset options for your application. You may change these defaults
|
12
|
+
| as required, but they're a perfect start for most applications.
|
13
|
+
|
|
14
|
+
*/
|
15
|
+
|
16
|
+
'defaults' => [
|
17
|
+
'guard' => 'web',
|
18
|
+
'passwords' => 'users',
|
19
|
+
],
|
20
|
+
|
21
|
+
/*
|
22
|
+
|--------------------------------------------------------------------------
|
23
|
+
| Authentication Guards
|
24
|
+
|--------------------------------------------------------------------------
|
25
|
+
|
|
26
|
+
| Next, you may define every authentication guard for your application.
|
27
|
+
| Of course, a great default configuration has been defined for you
|
28
|
+
| here which uses session storage and the Eloquent user provider.
|
29
|
+
|
|
30
|
+
| All authentication drivers have a user provider. This defines how the
|
31
|
+
| users are actually retrieved out of your database or other storage
|
32
|
+
| mechanisms used by this application to persist your user's data.
|
33
|
+
|
|
34
|
+
| Supported: "session"
|
35
|
+
|
|
36
|
+
*/
|
37
|
+
|
38
|
+
'guards' => [
|
39
|
+
'web' => [
|
40
|
+
'driver' => 'session',
|
41
|
+
'provider' => 'users',
|
42
|
+
],
|
43
|
+
],
|
44
|
+
|
45
|
+
/*
|
46
|
+
|--------------------------------------------------------------------------
|
47
|
+
| User Providers
|
48
|
+
|--------------------------------------------------------------------------
|
49
|
+
|
|
50
|
+
| All authentication drivers have a user provider. This defines how the
|
51
|
+
| users are actually retrieved out of your database or other storage
|
52
|
+
| mechanisms used by this application to persist your user's data.
|
53
|
+
|
|
54
|
+
| If you have multiple user tables or models you may configure multiple
|
55
|
+
| sources which represent each model / table. These sources may then
|
56
|
+
| be assigned to any extra authentication guards you have defined.
|
57
|
+
|
|
58
|
+
| Supported: "database", "eloquent"
|
59
|
+
|
|
60
|
+
*/
|
61
|
+
|
62
|
+
'providers' => [
|
63
|
+
'users' => [
|
64
|
+
'driver' => 'repository',
|
65
|
+
'repository' => Folklore\Contracts\Repositories\Users::class,
|
66
|
+
],
|
67
|
+
|
68
|
+
// 'users' => [
|
69
|
+
// 'driver' => 'eloquent',
|
70
|
+
// 'model' => App\Models\User::class,
|
71
|
+
// ],
|
72
|
+
|
73
|
+
// 'users' => [
|
74
|
+
// 'driver' => 'database',
|
75
|
+
// 'table' => 'users',
|
76
|
+
// ],
|
77
|
+
],
|
78
|
+
|
79
|
+
/*
|
80
|
+
|--------------------------------------------------------------------------
|
81
|
+
| Resetting Passwords
|
82
|
+
|--------------------------------------------------------------------------
|
83
|
+
|
|
84
|
+
| You may specify multiple password reset configurations if you have more
|
85
|
+
| than one user table or model in the application and you want to have
|
86
|
+
| separate password reset settings based on the specific user types.
|
87
|
+
|
|
88
|
+
| The expire time is the number of minutes that each reset token will be
|
89
|
+
| considered valid. This security feature keeps tokens short-lived so
|
90
|
+
| they have less time to be guessed. You may change this as needed.
|
91
|
+
|
|
92
|
+
*/
|
93
|
+
|
94
|
+
'passwords' => [
|
95
|
+
'users' => [
|
96
|
+
'provider' => 'users',
|
97
|
+
'table' => 'password_resets',
|
98
|
+
'expire' => 60,
|
99
|
+
'throttle' => 60,
|
100
|
+
],
|
101
|
+
],
|
102
|
+
|
103
|
+
/*
|
104
|
+
|--------------------------------------------------------------------------
|
105
|
+
| Password Confirmation Timeout
|
106
|
+
|--------------------------------------------------------------------------
|
107
|
+
|
|
108
|
+
| Here you may define the amount of seconds before a password confirmation
|
109
|
+
| times out and the user is prompted to re-enter their password via the
|
110
|
+
| confirmation screen. By default, the timeout lasts for three hours.
|
111
|
+
|
|
112
|
+
*/
|
113
|
+
|
114
|
+
'password_timeout' => 10800,
|
115
|
+
|
116
|
+
];
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
return [
|
4
|
+
|
5
|
+
/*
|
6
|
+
|--------------------------------------------------------------------------
|
7
|
+
| Third Party Services
|
8
|
+
|--------------------------------------------------------------------------
|
9
|
+
|
|
10
|
+
| This file is for storing the credentials for third party services such
|
11
|
+
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
12
|
+
| location for this type of information, allowing packages to have
|
13
|
+
| a conventional file to locate the various service credentials.
|
14
|
+
|
|
15
|
+
*/
|
16
|
+
|
17
|
+
'mailgun' => [
|
18
|
+
'domain' => env('MAILGUN_DOMAIN'),
|
19
|
+
'secret' => env('MAILGUN_SECRET'),
|
20
|
+
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
21
|
+
'scheme' => 'https',
|
22
|
+
],
|
23
|
+
|
24
|
+
'postmark' => [
|
25
|
+
'token' => env('POSTMARK_TOKEN'),
|
26
|
+
],
|
27
|
+
|
28
|
+
'ses' => [
|
29
|
+
'key' => env('AWS_ACCESS_KEY_ID'),
|
30
|
+
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
31
|
+
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
32
|
+
],
|
33
|
+
|
34
|
+
'google' => [
|
35
|
+
'tagmanager_id' => env('GOOGLE_TAGMANAGER_ID'),
|
36
|
+
'analytics_id' => env('GOOGLE_ANALYTICS_ID'),
|
37
|
+
],
|
38
|
+
|
39
|
+
];
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
return [
|
4
|
+
'title_401' => 'Error 401',
|
5
|
+
'description_401' => 'You are not authorized to access this page.',
|
6
|
+
|
7
|
+
'title_403' => 'Error 403',
|
8
|
+
'description_403' => 'Access to this page is forbidden',
|
9
|
+
|
10
|
+
'title_404' => 'Error 404',
|
11
|
+
'description_404' => 'This page doesn’t exists',
|
12
|
+
|
13
|
+
'title_500' => 'Error 500',
|
14
|
+
'description_500' => 'There was an error',
|
15
|
+
|
16
|
+
'goto_home' => 'Go to home',
|
17
|
+
];
|