generator-folklore 3.0.5 → 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/generators/build/index.js +1 -1
- package/lib/generators/eslint/index.js +1 -1
- package/lib/generators/intl/index.js +93 -0
- package/lib/generators/laravel-mediatheque/index.js +151 -0
- package/lib/generators/laravel-mediatheque/instructions/ServiceProvider.php +26 -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 +89 -28
- package/lib/generators/laravel-panneau/instructions/ServiceProvider.php +21 -0
- package/lib/generators/laravel-panneau/instructions/config.php +13 -0
- package/lib/generators/laravel-panneau/templates/app/Contracts/Repositories/Pages.php +19 -0
- package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Image.php +15 -0
- package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Text.php +12 -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 +4 -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/{Schemas → Panneau}/Fields/.gitkeep +0 -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 +10 -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/Http/Resources/UsersCollection.php +10 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/PanneauServiceProvider.php +74 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Policies/PanneauPolicy.php +32 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/ImageBlock.php +30 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/TextBlock.php +28 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks.php +45 -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/ImageBlock.php +27 -0
- package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/TextBlock.php +19 -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/config.php +29 -0
- package/lib/generators/laravel-panneau/templates/index.js +32 -0
- package/lib/generators/laravel-panneau/templates/lang/en/panneau.php +66 -0
- package/lib/generators/laravel-panneau/templates/lang/fr/panneau.php +66 -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/resources/assets/js/components/panneau/fields/PageSlug.jsx +68 -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 +519 -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/Repositories/Users.php +17 -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 +20 -0
- package/lib/generators/laravel-project/templates/laravel/app/Providers/AppServiceProvider.php +120 -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 +37 -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/image.php +204 -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/prettier/index.js +1 -1
- package/lib/generators/react-app/index.js +2 -2
- 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/generators/stylelint/index.js +1 -1
- package/lib/lib/generator.js +9 -0
- package/package.json +5 -4
- 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,32 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Panneau\Policies;
|
4
|
+
|
5
|
+
use Illuminate\Auth\Access\HandlesAuthorization;
|
6
|
+
use App\Contracts\Resources\User;
|
7
|
+
|
8
|
+
class PanneauPolicy
|
9
|
+
{
|
10
|
+
use HandlesAuthorization;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Create a new policy instance.
|
14
|
+
*
|
15
|
+
* @return void
|
16
|
+
*/
|
17
|
+
public function __construct()
|
18
|
+
{
|
19
|
+
//
|
20
|
+
}
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Determine if panneau can be viewed by the user.
|
24
|
+
*
|
25
|
+
* @param \App\User $user
|
26
|
+
* @return bool
|
27
|
+
*/
|
28
|
+
public function view(User $user)
|
29
|
+
{
|
30
|
+
return $user->role() === 'admin';
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Panneau\Resources\Blocks;
|
4
|
+
|
5
|
+
use Panneau\Support\ResourceType;
|
6
|
+
use Panneau\Fields\Image;
|
7
|
+
use Panneau\Fields\HtmlLocalized;
|
8
|
+
use Panneau\Fields\TextLocalized;
|
9
|
+
|
10
|
+
class ImageBlock extends ResourceType
|
11
|
+
{
|
12
|
+
public function id(): string
|
13
|
+
{
|
14
|
+
return 'image';
|
15
|
+
}
|
16
|
+
|
17
|
+
public function name(): string
|
18
|
+
{
|
19
|
+
return trans('panneau.blocks_image');
|
20
|
+
}
|
21
|
+
|
22
|
+
public function fields(): array
|
23
|
+
{
|
24
|
+
return [
|
25
|
+
Image::make('image')->withTransLabel('panneau.fields.image'),
|
26
|
+
HtmlLocalized::make('caption')->withTransLabel('panneau.fields.caption'),
|
27
|
+
TextLocalized::make('credits')->withTransLabel('panneau.fields.credits'),
|
28
|
+
];
|
29
|
+
}
|
30
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Panneau\Resources\Blocks;
|
4
|
+
|
5
|
+
use Panneau\Support\ResourceType;
|
6
|
+
use Panneau\Fields\TextLocalized;
|
7
|
+
use Panneau\Fields\HtmlLocalized;
|
8
|
+
|
9
|
+
class TextBlock extends ResourceType
|
10
|
+
{
|
11
|
+
public function id(): string
|
12
|
+
{
|
13
|
+
return 'text';
|
14
|
+
}
|
15
|
+
|
16
|
+
public function name(): string
|
17
|
+
{
|
18
|
+
return trans('panneau.blocks_text');
|
19
|
+
}
|
20
|
+
|
21
|
+
public function fields(): array
|
22
|
+
{
|
23
|
+
return [
|
24
|
+
TextLocalized::make('title')->withTransLabel('panneau.fields.title'),
|
25
|
+
HtmlLocalized::make('body')->withTransLabel('panneau.fields.body'),
|
26
|
+
];
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Panneau\Resources;
|
4
|
+
|
5
|
+
use Panneau\Support\Resource;
|
6
|
+
|
7
|
+
class Blocks extends Resource
|
8
|
+
{
|
9
|
+
public static $repository = \App\Contracts\Repositories\Blocks::class;
|
10
|
+
|
11
|
+
public static $jsonResource = \App\Panneau\Http\Resources\BlockResource::class;
|
12
|
+
|
13
|
+
public static $jsonCollection = \App\Panneau\Http\Resources\BlocksCollection::class;
|
14
|
+
|
15
|
+
public static $settings = [
|
16
|
+
'hideInNavbar' => true,
|
17
|
+
];
|
18
|
+
|
19
|
+
public static $types = [
|
20
|
+
\App\Panneau\Resources\Blocks\TextBlock::class,
|
21
|
+
\App\Panneau\Resources\Blocks\ImageBlock::class,
|
22
|
+
];
|
23
|
+
|
24
|
+
public function name(): string
|
25
|
+
{
|
26
|
+
return trans('panneau.blocks.name');
|
27
|
+
}
|
28
|
+
|
29
|
+
public function index(): ?array
|
30
|
+
{
|
31
|
+
return [
|
32
|
+
'columns' => [
|
33
|
+
[
|
34
|
+
'id' => 'type',
|
35
|
+
'label' => 'Type',
|
36
|
+
],
|
37
|
+
],
|
38
|
+
];
|
39
|
+
}
|
40
|
+
|
41
|
+
public function fields(): array
|
42
|
+
{
|
43
|
+
return [];
|
44
|
+
}
|
45
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Panneau\Resources\Pages;
|
4
|
+
|
5
|
+
use Panneau\Support\ResourceType;
|
6
|
+
use Folklore\Panneau\Fields\Blocks;
|
7
|
+
use Folklore\Panneau\Fields\Page as PageField;
|
8
|
+
|
9
|
+
class Page extends ResourceType
|
10
|
+
{
|
11
|
+
public function id(): string
|
12
|
+
{
|
13
|
+
return 'page';
|
14
|
+
}
|
15
|
+
|
16
|
+
public function name(): string
|
17
|
+
{
|
18
|
+
return trans('panneau.pages_page');
|
19
|
+
}
|
20
|
+
|
21
|
+
public function fields(): array
|
22
|
+
{
|
23
|
+
return [
|
24
|
+
PageField::make('parent')->withTransLabel('panneau.fields.parent'),
|
25
|
+
Blocks::make('blocks')->withTransLabel('panneau.fields.blocks'),
|
26
|
+
];
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,92 @@
|
|
1
|
+
<?php
|
2
|
+
namespace App\Panneau\Resources;
|
3
|
+
|
4
|
+
use Folklore\Panneau\Fields\PageSlugLocalized;
|
5
|
+
use Panneau\Fields\TextLocalized;
|
6
|
+
use Panneau\Fields\ImageLocalized;
|
7
|
+
use Panneau\Fields\Toggle;
|
8
|
+
use Panneau\Support\Resource;
|
9
|
+
|
10
|
+
class Pages extends Resource
|
11
|
+
{
|
12
|
+
public static $repository = \App\Contracts\Repositories\Pages::class;
|
13
|
+
|
14
|
+
public static $controller = \App\Panneau\Http\Controllers\PagesController::class;
|
15
|
+
|
16
|
+
public static $jsonResource = \App\Panneau\Http\Resources\PageResource::class;
|
17
|
+
|
18
|
+
public static $jsonCollection = \App\Panneau\Http\Resources\PagesCollection::class;
|
19
|
+
|
20
|
+
public static $types = [\App\Panneau\Resources\Pages\Page::class];
|
21
|
+
|
22
|
+
public static $settings = [
|
23
|
+
'hideInNavbar' => false,
|
24
|
+
'indexIsPaginated' => true,
|
25
|
+
'canCreate' => true,
|
26
|
+
];
|
27
|
+
|
28
|
+
public function name(): string
|
29
|
+
{
|
30
|
+
return trans('panneau.pages.name');
|
31
|
+
}
|
32
|
+
|
33
|
+
public function index(): ?array
|
34
|
+
{
|
35
|
+
return [
|
36
|
+
'columns' => [
|
37
|
+
[
|
38
|
+
'label' => trans('panneau.columns.title'),
|
39
|
+
'component' => 'text-localized',
|
40
|
+
'path' => 'title',
|
41
|
+
],
|
42
|
+
[
|
43
|
+
'id' => 'type',
|
44
|
+
'label' => 'Type',
|
45
|
+
'component' => 'label',
|
46
|
+
'labels' => $this->getTypes()->mapWithKeys(function ($type) {
|
47
|
+
return [
|
48
|
+
$type->id() => $type->name(),
|
49
|
+
];
|
50
|
+
}),
|
51
|
+
],
|
52
|
+
[
|
53
|
+
'id' => 'parent',
|
54
|
+
'label' => trans('panneau.columns.parent_page'),
|
55
|
+
'path' => 'parent.title.fr',
|
56
|
+
],
|
57
|
+
'published',
|
58
|
+
[
|
59
|
+
'id' => 'actions',
|
60
|
+
'actions' => ['show', 'edit', 'delete'],
|
61
|
+
],
|
62
|
+
],
|
63
|
+
'filters' => [
|
64
|
+
[
|
65
|
+
'name' => 'search',
|
66
|
+
'component' => 'search',
|
67
|
+
'placeholder' => trans('panneau.filters.search'),
|
68
|
+
],
|
69
|
+
],
|
70
|
+
];
|
71
|
+
}
|
72
|
+
|
73
|
+
public function fields(): array
|
74
|
+
{
|
75
|
+
return [
|
76
|
+
Toggle::make('published')
|
77
|
+
->withTransLabel('panneau.fields.published')
|
78
|
+
->hideInForm(),
|
79
|
+
TextLocalized::make('title')->withTransLabel('panneau.fields.title'),
|
80
|
+
PageSlugLocalized::make('slug')
|
81
|
+
->isDisabled()
|
82
|
+
->withTransLabel('panneau.fields.url'),
|
83
|
+
TextLocalized::make('description')
|
84
|
+
->isRequired()
|
85
|
+
->isTextarea()
|
86
|
+
->withTransLabel('panneau.fields.description_short'),
|
87
|
+
ImageLocalized::make('image')
|
88
|
+
->withTransLabel('panneau.fields.image')
|
89
|
+
->withButton(),
|
90
|
+
];
|
91
|
+
}
|
92
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Panneau\Resources;
|
4
|
+
|
5
|
+
use Panneau\Support\Resource;
|
6
|
+
use Panneau\Fields\Text;
|
7
|
+
use Panneau\Fields\Email;
|
8
|
+
use Panneau\Fields\Password;
|
9
|
+
use Panneau\Fields\Select;
|
10
|
+
|
11
|
+
class Users extends Resource
|
12
|
+
{
|
13
|
+
public static $repository = \App\Contracts\Repositories\Users::class;
|
14
|
+
|
15
|
+
public static $controller = \App\Panneau\Http\Controllers\UsersController::class;
|
16
|
+
|
17
|
+
public static $jsonResource = \App\Panneau\Http\Resources\UserResource::class;
|
18
|
+
|
19
|
+
public static $jsonCollection = \App\Panneau\Http\Resources\UsersCollection::class;
|
20
|
+
|
21
|
+
public static $settings = [
|
22
|
+
'hideInNavbar' => false,
|
23
|
+
'indexIsPaginated' => true,
|
24
|
+
'canCreate' => true,
|
25
|
+
];
|
26
|
+
|
27
|
+
public function name(): string
|
28
|
+
{
|
29
|
+
return trans('panneau.users.name');
|
30
|
+
}
|
31
|
+
|
32
|
+
public function index(): ?array
|
33
|
+
{
|
34
|
+
return [
|
35
|
+
'columns' => ['name', 'email', 'role'],
|
36
|
+
];
|
37
|
+
}
|
38
|
+
|
39
|
+
public function fields(): array
|
40
|
+
{
|
41
|
+
return [
|
42
|
+
Text::make('name')->withTransLabel('panneau.fields.name'),
|
43
|
+
Email::make('email')->withTransLabel('panneau.fields.email'),
|
44
|
+
Password::make('password')->withTransLabel('panneau.fields.password'),
|
45
|
+
Select::make('role')
|
46
|
+
->withTransLabel('panneau.fields.role')
|
47
|
+
->withOptions([
|
48
|
+
[
|
49
|
+
'value' => 'admin',
|
50
|
+
'label' => trans('panneau.roles.admin'),
|
51
|
+
],
|
52
|
+
])
|
53
|
+
->withoutReset()
|
54
|
+
->withDefaultValue('guest'),
|
55
|
+
];
|
56
|
+
}
|
57
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Repositories;
|
4
|
+
|
5
|
+
use Folklore\Repositories\Pages as BasePages;
|
6
|
+
use App\Contracts\Repositories\Pages as PagesContract;
|
7
|
+
use Folklore\Models\Page as PageBaseModel;
|
8
|
+
use App\Models\Page as PageModel;
|
9
|
+
use App\Contracts\Resources\Page as PageContract;
|
10
|
+
|
11
|
+
class Pages extends BasePages implements PagesContract
|
12
|
+
{
|
13
|
+
protected function newModel(): PageBaseModel
|
14
|
+
{
|
15
|
+
return new PageModel();
|
16
|
+
}
|
17
|
+
|
18
|
+
public function findById(string $id): ?PageContract
|
19
|
+
{
|
20
|
+
return parent::findById($id);
|
21
|
+
}
|
22
|
+
|
23
|
+
public function findByHandle(string $handle): ?PageContract
|
24
|
+
{
|
25
|
+
return parent::findByHandle($handle);
|
26
|
+
}
|
27
|
+
|
28
|
+
public function findBySlug(string $slug, string $locale = null): ?PageContract
|
29
|
+
{
|
30
|
+
return parent::findBySlug($slug, $locale);
|
31
|
+
}
|
32
|
+
|
33
|
+
public function create($data): PageContract
|
34
|
+
{
|
35
|
+
return parent::create($data);
|
36
|
+
}
|
37
|
+
|
38
|
+
public function update(string $id, $data): ?PageContract
|
39
|
+
{
|
40
|
+
return parent::update($id, $data);
|
41
|
+
}
|
42
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Resources\Blocks;
|
4
|
+
|
5
|
+
use Folklore\Resources\Block;
|
6
|
+
use App\Contracts\Resources\Blocks\Text as TextBlockContract;
|
7
|
+
use Folklore\Contracts\Resources\Image as ImageContract;
|
8
|
+
use Folklore\Resources\Image;
|
9
|
+
|
10
|
+
class ImageBlock extends Block implements TextBlockContract
|
11
|
+
{
|
12
|
+
public function image(): ?ImageContract
|
13
|
+
{
|
14
|
+
$image = data_get($this->data, 'image');
|
15
|
+
return isset($image) ? new Image($image) : null;
|
16
|
+
}
|
17
|
+
|
18
|
+
public function caption(string $locale): ?string
|
19
|
+
{
|
20
|
+
return data_get($this->data, 'caption.' . $locale);
|
21
|
+
}
|
22
|
+
|
23
|
+
public function credits(string $locale): ?string
|
24
|
+
{
|
25
|
+
return data_get($this->data, 'credits.' . $locale);
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Resources\Blocks;
|
4
|
+
|
5
|
+
use Folklore\Resources\Block;
|
6
|
+
use App\Contracts\Resources\Blocks\Text as TextBlockContract;
|
7
|
+
|
8
|
+
class TextBlock extends Block implements TextBlockContract
|
9
|
+
{
|
10
|
+
public function title(string $locale): ?string
|
11
|
+
{
|
12
|
+
return data_get($this->data, 'title.' . $locale);
|
13
|
+
}
|
14
|
+
|
15
|
+
public function body(string $locale): ?string
|
16
|
+
{
|
17
|
+
return data_get($this->data, 'body.' . $locale);
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
return [
|
4
|
+
'intl' => [
|
5
|
+
'locale' => 'fr',
|
6
|
+
'locales' => ['fr', 'en'],
|
7
|
+
'translations' => ['panneau::resources', 'panneau'],
|
8
|
+
],
|
9
|
+
|
10
|
+
'resources' => [
|
11
|
+
\App\Panneau\Resources\Blocks::class,
|
12
|
+
\App\Panneau\Resources\Pages::class,
|
13
|
+
\App\Panneau\Resources\Users::class,
|
14
|
+
],
|
15
|
+
|
16
|
+
'routes' => [
|
17
|
+
// Path to the routes file that will be automatically loaded. Set to null
|
18
|
+
// to prevent auto-loading of routes.
|
19
|
+
'map' => base_path('routes/panneau.php'),
|
20
|
+
|
21
|
+
'prefix' => 'panneau',
|
22
|
+
|
23
|
+
'middleware' => [\Panneau\Http\Middleware\DispatchHandlingRequestEvent::class],
|
24
|
+
|
25
|
+
'custom' => [],
|
26
|
+
|
27
|
+
'without_patterns' => true,
|
28
|
+
],
|
29
|
+
];
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { createRoot } from 'react-dom/client';
|
3
|
+
|
4
|
+
import shouldPolyfill from './polyfills/should';
|
5
|
+
|
6
|
+
function getAppProps() {
|
7
|
+
return window.props || {};
|
8
|
+
}
|
9
|
+
|
10
|
+
function renderApp(Container, props) {
|
11
|
+
const element = document.getElementById('app');
|
12
|
+
const container = React.createElement(Container, props);
|
13
|
+
const strictMode = React.createElement(React.StrictMode, {}, container);
|
14
|
+
const root = createRoot(element);
|
15
|
+
root.render(strictMode);
|
16
|
+
}
|
17
|
+
|
18
|
+
function loadContainer({ isPanneau = false }) {
|
19
|
+
return isPanneau
|
20
|
+
? import('./components/Panneau').then(({ default: Container }) => Container)
|
21
|
+
: import('./components/Container').then(({ default: Container }) => Container);
|
22
|
+
}
|
23
|
+
|
24
|
+
const props = getAppProps();
|
25
|
+
|
26
|
+
if (shouldPolyfill()) {
|
27
|
+
import('./polyfills/index')
|
28
|
+
.then(() => loadContainer(props))
|
29
|
+
.then((Container) => renderApp(Container, props));
|
30
|
+
} else {
|
31
|
+
loadContainer(props).then((Container) => renderApp(Container, props));
|
32
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<?php
|
2
|
+
// prettier-ignore
|
3
|
+
return [
|
4
|
+
'fields' => [
|
5
|
+
'title' => 'Title',
|
6
|
+
'url' => 'Address',
|
7
|
+
'published' => 'Published',
|
8
|
+
'description_short' => 'Short description',
|
9
|
+
'caption' => 'Caption',
|
10
|
+
'credits' => 'Credits',
|
11
|
+
'name' => 'Name',
|
12
|
+
'email' => 'Email',
|
13
|
+
'password' => 'Password',
|
14
|
+
'image' => 'Image',
|
15
|
+
'body' => 'Text',
|
16
|
+
'parent' => 'Parent',
|
17
|
+
'blocks' => 'Blocks',
|
18
|
+
'role' => 'Role',
|
19
|
+
|
20
|
+
'page' => 'Page',
|
21
|
+
'pages' => 'Pages',
|
22
|
+
'no_pages' => 'No page',
|
23
|
+
'add_page' => 'Add a page',
|
24
|
+
'select_page' => 'Select a page...',
|
25
|
+
|
26
|
+
'item' => 'Item',
|
27
|
+
'items' => 'Items',
|
28
|
+
'no_items' => 'No item',
|
29
|
+
'add_item' => 'Add an item',
|
30
|
+
'select_item' => 'Select an item...',
|
31
|
+
|
32
|
+
'block' => 'Block',
|
33
|
+
'blocks' => 'Blocks',
|
34
|
+
'no_blocks' => 'No blocks',
|
35
|
+
'add_block' => 'Add a block',
|
36
|
+
'select_block' => 'Select a block...',
|
37
|
+
],
|
38
|
+
|
39
|
+
'filters' => [
|
40
|
+
'search' => 'Search',
|
41
|
+
],
|
42
|
+
|
43
|
+
'columns' => [
|
44
|
+
'title' => 'Title',
|
45
|
+
'parent_page' => 'Parent page',
|
46
|
+
],
|
47
|
+
|
48
|
+
'roles' => [
|
49
|
+
'guest' => 'Guest',
|
50
|
+
'admin' => 'Administrator',
|
51
|
+
],
|
52
|
+
|
53
|
+
'pages' => [
|
54
|
+
'name' => 'Pages',
|
55
|
+
],
|
56
|
+
'pages_page' => 'Page',
|
57
|
+
|
58
|
+
'users' => [
|
59
|
+
'name' => 'Users',
|
60
|
+
],
|
61
|
+
|
62
|
+
'blocks' => [
|
63
|
+
'name' => 'Blocks',
|
64
|
+
],
|
65
|
+
'blocks_text' => 'Text',
|
66
|
+
];
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<?php
|
2
|
+
// prettier-ignore
|
3
|
+
return [
|
4
|
+
'fields' => [
|
5
|
+
'title' => 'Titre',
|
6
|
+
'url' => 'Adresse',
|
7
|
+
'published' => 'Publié',
|
8
|
+
'description_short' => 'Description courte',
|
9
|
+
'caption' => 'Libellé',
|
10
|
+
'credits' => 'Crédits',
|
11
|
+
'name' => 'Nom',
|
12
|
+
'email' => 'Courriel',
|
13
|
+
'password' => 'Mot de passe',
|
14
|
+
'image' => 'Image',
|
15
|
+
'body' => 'Texte',
|
16
|
+
'parent' => 'Parent',
|
17
|
+
'blocks' => 'Blocs',
|
18
|
+
'role' => 'Rôle',
|
19
|
+
|
20
|
+
'page' => 'Page',
|
21
|
+
'pages' => 'Pages',
|
22
|
+
'no_pages' => 'Aucune page',
|
23
|
+
'add_page' => 'Ajouter une page',
|
24
|
+
'select_page' => 'Sélectionner une page...',
|
25
|
+
|
26
|
+
'item' => 'Item',
|
27
|
+
'items' => 'Items',
|
28
|
+
'no_items' => 'Aucun item',
|
29
|
+
'add_item' => 'Ajouter un item',
|
30
|
+
'select_item' => 'Sélectionner un item...',
|
31
|
+
|
32
|
+
'block' => 'Bloc',
|
33
|
+
'blocks' => 'Blocs',
|
34
|
+
'no_blocks' => 'Aucun bloc',
|
35
|
+
'add_block' => 'Ajouter un bloc',
|
36
|
+
'select_block' => 'Sélectionner un bloc...',
|
37
|
+
],
|
38
|
+
|
39
|
+
'filters' => [
|
40
|
+
'search' => 'Rechercher',
|
41
|
+
],
|
42
|
+
|
43
|
+
'columns' => [
|
44
|
+
'title' => 'Titre',
|
45
|
+
'parent_page' => 'Page parente',
|
46
|
+
],
|
47
|
+
|
48
|
+
'roles' => [
|
49
|
+
'guest' => 'Visiteur',
|
50
|
+
'admin' => 'Administrateur',
|
51
|
+
],
|
52
|
+
|
53
|
+
'pages' => [
|
54
|
+
'name' => 'Pages',
|
55
|
+
],
|
56
|
+
'pages_page' => 'Page',
|
57
|
+
|
58
|
+
'users' => [
|
59
|
+
'name' => 'Utilisateurs',
|
60
|
+
],
|
61
|
+
|
62
|
+
'blocks' => [
|
63
|
+
'name' => 'Blocs',
|
64
|
+
],
|
65
|
+
'blocks_text' => 'Texte',
|
66
|
+
];
|