generator-folklore 3.0.6 → 3.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/lib/generators/build/index.js +1 -1
  2. package/lib/generators/eslint/index.js +1 -1
  3. package/lib/generators/intl/index.js +1 -1
  4. package/lib/generators/laravel-mediatheque/index.js +18 -0
  5. package/lib/generators/laravel-mediatheque/instructions/ServiceProvider.php +26 -0
  6. package/lib/generators/laravel-panneau/index.js +45 -5
  7. package/lib/generators/laravel-panneau/instructions/ServiceProvider.php +21 -0
  8. package/lib/generators/laravel-panneau/instructions/config.php +13 -0
  9. package/lib/generators/laravel-panneau/templates/app/Contracts/Repositories/Pages.php +2 -2
  10. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Image.php +15 -0
  11. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Text.php +2 -0
  12. package/lib/generators/laravel-panneau/templates/app/Models/Block.php +1 -0
  13. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/.gitkeep +0 -0
  14. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlocksCollection.php +2 -0
  15. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/UsersCollection.php +10 -0
  16. package/lib/generators/laravel-panneau/templates/app/Panneau/PanneauServiceProvider.php +30 -4
  17. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/ImageBlock.php +30 -0
  18. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/TextBlock.php +3 -2
  19. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks.php +4 -1
  20. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages/Page.php +2 -2
  21. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages.php +2 -2
  22. package/lib/generators/laravel-panneau/templates/app/Repositories/Pages.php +2 -2
  23. package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/ImageBlock.php +27 -0
  24. package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/TextBlock.php +6 -1
  25. package/lib/generators/laravel-panneau/templates/config.php +29 -0
  26. package/lib/generators/laravel-panneau/templates/index.js +1 -1
  27. package/lib/generators/laravel-panneau/templates/lang/en/panneau.php +4 -0
  28. package/lib/generators/laravel-panneau/templates/lang/fr/panneau.php +4 -0
  29. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlug.jsx +68 -0
  30. package/lib/generators/laravel-project/index.js +27 -12
  31. package/lib/generators/laravel-project/templates/laravel/app/Contracts/Repositories/Users.php +17 -0
  32. package/lib/generators/laravel-project/templates/laravel/app/Models/User.php +0 -30
  33. package/lib/generators/laravel-project/templates/laravel/app/Providers/AppServiceProvider.php +90 -15
  34. package/lib/generators/laravel-project/templates/laravel/app/Repositories/Users.php +4 -3
  35. package/lib/generators/laravel-project/templates/laravel/config/app.php +2 -2
  36. package/lib/generators/laravel-project/templates/laravel/config/image.php +204 -0
  37. package/lib/generators/prettier/index.js +1 -1
  38. package/lib/generators/react-app/index.js +2 -2
  39. package/lib/generators/stylelint/index.js +1 -1
  40. package/package.json +5 -4
  41. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Block.php +0 -22
  42. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Blocks.php +0 -87
  43. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Page.php +0 -51
  44. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlug.php +0 -34
  45. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlugLocalized.php +0 -18
  46. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/BlockWithBlocks.php +0 -110
@@ -1,51 +0,0 @@
1
- <?php
2
-
3
- namespace App\Panneau\Fields;
4
-
5
- use Panneau\Fields\ResourceItem;
6
-
7
- class Page extends ResourceItem
8
- {
9
- protected $query = [
10
- 'paginated' => false,
11
- ];
12
-
13
- protected $pageTypes = [];
14
-
15
- public function resource(): string
16
- {
17
- return 'pages';
18
- }
19
-
20
- public function component(): string
21
- {
22
- return 'item';
23
- }
24
-
25
- public function attributes(): ?array
26
- {
27
- $query = $this->query;
28
- if (isset($this->pageTypes) && sizeof($this->pageTypes) > 0) {
29
- $query['type'] = $this->pageTypes;
30
- }
31
-
32
- return array_merge(parent::attributes(), [
33
- 'placeholder' => trans('panneau.forms.page_placeholder'),
34
- 'itemLabelPath' => 'title.'.app()->getLocale(),
35
- 'itemImagePath' => null,
36
- 'requestQuery' => $query,
37
- ]);
38
- }
39
-
40
- public function withQuery($query)
41
- {
42
- $this->query = $query;
43
- return $this;
44
- }
45
-
46
- public function withTypes($types)
47
- {
48
- $this->pageTypes = is_array($types) ? $types : func_get_args();
49
- return $this;
50
- }
51
- }
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- namespace App\Panneau\Fields;
4
-
5
- use Panneau\Fields\Text;
6
-
7
- class PageSlug extends Text
8
- {
9
- public function component(): string
10
- {
11
- return 'page-slug';
12
- }
13
-
14
- public function attributes(): ?array
15
- {
16
- $locale = app()->getLocale();
17
- $locales = config('locale.locales');
18
- $finalLocale = in_array($this->name, $locales) ? $this->name : $locale;
19
-
20
- return array_merge(parent::attributes(), [
21
- 'routes' => [
22
- 'page' => url()->routeForReactRouter($finalLocale . '.page', [
23
- 'withoutPatterns' => true,
24
- ]),
25
- 'page_with_parent' => url()->routeForReactRouter(
26
- $finalLocale . '.page_with_parent',
27
- [
28
- 'withoutPatterns' => true,
29
- ]
30
- ),
31
- ],
32
- ]);
33
- }
34
- }
@@ -1,18 +0,0 @@
1
- <?php
2
-
3
- namespace App\Panneau\Fields;
4
-
5
- use Panneau\Support\LocalizedField;
6
-
7
- class PageSlugLocalized extends LocalizedField
8
- {
9
- public function component(): string
10
- {
11
- return 'page-slug-localized';
12
- }
13
-
14
- public function field($locale)
15
- {
16
- return new PageSlug($locale);
17
- }
18
- }
@@ -1,110 +0,0 @@
1
- <?php
2
-
3
- namespace App\Panneau\Resources\Blocks;
4
-
5
- use Panneau\Contracts\ResourceType;
6
- use Panneau\Contracts\Repository;
7
- use Panneau\Contracts\Resource;
8
- use Panneau\Contracts\ResourceItem;
9
- use App\Panneau\Fields\Blocks;
10
- use JsonSerializable;
11
- use Illuminate\Contracts\Support\Arrayable;
12
- use Illuminate\Contracts\Support\Jsonable;
13
-
14
- class BlockWithBlocks implements ResourceType, Arrayable, Jsonable
15
- {
16
- protected $type;
17
-
18
- protected $depth;
19
-
20
- public function __construct(ResourceType $type, $depth)
21
- {
22
- $this->type = $type;
23
- $this->depth = $depth;
24
- }
25
-
26
- public function currentDepth(): int
27
- {
28
- return $this->depth;
29
- }
30
-
31
- public function id(): string
32
- {
33
- return $this->type->id();
34
- }
35
-
36
- public function name(): string
37
- {
38
- return $this->type->name();
39
- }
40
-
41
- public function fields(): array
42
- {
43
- return collect($this->type->fields())
44
- ->map(function ($field) {
45
- return $field instanceof Blocks ? $field->currentDepth($this->depth) : $field;
46
- })
47
- ->toArray();
48
- }
49
-
50
- public function resource(): Resource
51
- {
52
- return $this->type->resource();
53
- }
54
-
55
- public function settings(): ?array
56
- {
57
- return $this->type->settings();
58
- }
59
-
60
- public function makeRepository(): ?Repository
61
- {
62
- return $this->type->makeRepository();
63
- }
64
-
65
- public function makeJsonResource(ResourceItem $item): ?JsonSerializable
66
- {
67
- return $this->type->makeJsonResource($item);
68
- }
69
-
70
- public function makeJsonCollection($resources): ?JsonSerializable
71
- {
72
- return $this->type->makeJsonCollection($resources);
73
- }
74
-
75
- public function toArray()
76
- {
77
- $id = $this->id();
78
- $data = [
79
- 'id' => $this->id(),
80
- 'name' => $this->name(),
81
- 'fields' => collect($this->resource()->fields())
82
- ->filter(function ($field) use ($id) {
83
- $excepTypes = $field->exceptTypes();
84
- $onlyTypes = $field->onlyTypes();
85
- return (is_null($excepTypes) || !in_array($id, $excepTypes)) &&
86
- (is_null($onlyTypes) || in_array($id, $onlyTypes));
87
- })
88
- ->merge($this->fields())
89
- ->values()
90
- ->toArray(),
91
- ];
92
-
93
- $settings = $this->settings();
94
- if (isset($settings)) {
95
- $data['settings'] = $settings;
96
- }
97
-
98
- return $data;
99
- }
100
-
101
- public function jsonSerialize()
102
- {
103
- return $this->type->jsonSerialize();
104
- }
105
-
106
- public function toJson($options = 0)
107
- {
108
- return $this->type->toJson($options);
109
- }
110
- }