generator-folklore 3.0.9 → 3.0.10
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/generators/laravel-panneau/templates/app/Http/Middleware/Authenticate.php +1 -1
- package/lib/generators/laravel-panneau/templates/app/Http/Resources/PageResource.php +1 -3
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PageResource.php +5 -5
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/ParentPageResource.php +43 -0
- package/lib/generators/laravel-panneau/templates/app/Resources/Block.php +2 -2
- package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/ImageBlock.php +2 -2
- package/lib/generators/laravel-panneau/templates/app/Resources/Page.php +2 -2
- package/lib/generators/laravel-project/templates/laravel/resources/views/assets/.gitignore +2 -0
- package/package.json +2 -2
@@ -30,9 +30,7 @@ class PageResource extends JsonResource
|
|
30
30
|
'slug' => $this->slug($locale),
|
31
31
|
'image' => !is_null($image) ? new MediaResource($image) : null,
|
32
32
|
'parent' =>
|
33
|
-
!is_null($parent) && $parent instanceof Page
|
34
|
-
? new PageResource($parent)
|
35
|
-
: null,
|
33
|
+
!is_null($parent) && $parent instanceof Page ? new PageResource($parent) : null,
|
36
34
|
|
37
35
|
$this->mergeWhen($this->resource instanceof HasBlocks, function () {
|
38
36
|
$blocks = $this->blocks();
|
package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PageResource.php
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
namespace App\Panneau\Http\Resources;
|
4
4
|
|
5
5
|
use Illuminate\Http\Resources\Json\JsonResource;
|
6
|
-
use
|
6
|
+
use Folklore\Http\Resources\MediaResource;
|
7
7
|
use App\Contracts\Resources\Page;
|
8
|
-
use
|
8
|
+
use Folklore\Contracts\Resources\HasBlocks;
|
9
9
|
use Folklore\Http\Resources\LocalizedResource;
|
10
10
|
use App\Contracts\Resources\Pages\Home as HomePage;
|
11
11
|
|
@@ -19,8 +19,8 @@ class PageResource extends JsonResource
|
|
19
19
|
*/
|
20
20
|
public function toArray($request)
|
21
21
|
{
|
22
|
-
$
|
23
|
-
$
|
22
|
+
$image = $this->image();
|
23
|
+
$parent = $this->parent();
|
24
24
|
|
25
25
|
return [
|
26
26
|
'id' => $this->id(),
|
@@ -35,7 +35,7 @@ class PageResource extends JsonResource
|
|
35
35
|
'slug' => new LocalizedResource(function ($locale) {
|
36
36
|
return $this->slug($locale);
|
37
37
|
}),
|
38
|
-
'image' => !is_null($image) ? new
|
38
|
+
'image' => !is_null($image) ? new MediaResource($image) : null,
|
39
39
|
'parent' =>
|
40
40
|
!is_null($parent) && $parent instanceof Page
|
41
41
|
? new ParentPageResource($parent)
|
package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/ParentPageResource.php
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace App\Panneau\Http\Resources;
|
4
|
+
|
5
|
+
use Illuminate\Http\Resources\Json\JsonResource;
|
6
|
+
use Folklore\Http\Resources\MediaResource;
|
7
|
+
use App\Contracts\Resources\Page;
|
8
|
+
use Folklore\Http\Resources\LocalizedResource;
|
9
|
+
|
10
|
+
class ParentPageResource extends JsonResource
|
11
|
+
{
|
12
|
+
/**
|
13
|
+
* Transform the resource into an array.
|
14
|
+
*
|
15
|
+
* @param \Illuminate\Http\Request $request
|
16
|
+
* @return array
|
17
|
+
*/
|
18
|
+
public function toArray($request)
|
19
|
+
{
|
20
|
+
$image = $this->image();
|
21
|
+
$parent = $this->parent();
|
22
|
+
|
23
|
+
return [
|
24
|
+
'id' => $this->id(),
|
25
|
+
'type' => $this->type(),
|
26
|
+
'published' => $this->published(),
|
27
|
+
'title' => new LocalizedResource(function ($locale) {
|
28
|
+
return $this->title($locale);
|
29
|
+
}),
|
30
|
+
'description' => new LocalizedResource(function ($locale) {
|
31
|
+
return $this->description($locale);
|
32
|
+
}),
|
33
|
+
'slug' => new LocalizedResource(function ($locale) {
|
34
|
+
return $this->slug($locale);
|
35
|
+
}),
|
36
|
+
'image' => !is_null($image) ? new MediaResource($image) : null,
|
37
|
+
'parent' =>
|
38
|
+
!is_null($parent) && $parent instanceof Page
|
39
|
+
? new ParentPageResource($parent)
|
40
|
+
: null,
|
41
|
+
];
|
42
|
+
}
|
43
|
+
}
|
@@ -3,11 +3,11 @@
|
|
3
3
|
namespace App\Resources\Blocks;
|
4
4
|
|
5
5
|
use App\Resources\Block;
|
6
|
-
use App\Contracts\Resources\Blocks\
|
6
|
+
use App\Contracts\Resources\Blocks\Image as ImageBlockContract;
|
7
7
|
use Folklore\Contracts\Resources\Image as ImageContract;
|
8
8
|
use Folklore\Resources\Image;
|
9
9
|
|
10
|
-
class ImageBlock extends Block implements
|
10
|
+
class ImageBlock extends Block implements ImageBlockContract
|
11
11
|
{
|
12
12
|
public function image(): ?ImageContract
|
13
13
|
{
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "generator-folklore",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.10",
|
4
4
|
"description": "Yeoman generator for projects at Folklore",
|
5
5
|
"keywords": [
|
6
6
|
"yeoman-generator"
|
@@ -40,5 +40,5 @@
|
|
40
40
|
"yeoman-generator": "^5.7.0",
|
41
41
|
"yeoman-remote": "^1.0.1"
|
42
42
|
},
|
43
|
-
"gitHead": "
|
43
|
+
"gitHead": "1d7f2e259b004828e208b643fb2d123aad8cc5ec"
|
44
44
|
}
|