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.
@@ -16,7 +16,7 @@ class Authenticate extends Middleware
16
16
  {
17
17
  if (!$request->expectsJson()) {
18
18
  $routeWithLocale =
19
- route_with_locale('login') .
19
+ route('panneau.auth.login') .
20
20
  '?' .
21
21
  http_build_query([
22
22
  'next' => $request->fullUrl(),
@@ -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();
@@ -3,9 +3,9 @@
3
3
  namespace App\Panneau\Http\Resources;
4
4
 
5
5
  use Illuminate\Http\Resources\Json\JsonResource;
6
- use App\Http\Resources\Medias\ImageResource;
6
+ use Folklore\Http\Resources\MediaResource;
7
7
  use App\Contracts\Resources\Page;
8
- use App\Contracts\Resources\HasBlocks;
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
- $locale = $request->locale();
23
- $isPanneauIndex = $request->isPanneauIndex();
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 ImageResource($image) : null,
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)
@@ -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,8 +3,8 @@
3
3
  namespace App\Resources;
4
4
 
5
5
  use Folklore\Resources\Block as BaseBlock;
6
+ use App\Contracts\Resources\Block as BlockContract;
6
7
 
7
- class Block extends BaseBlock
8
+ class Block extends BaseBlock implements BlockContract
8
9
  {
9
-
10
10
  }
@@ -3,11 +3,11 @@
3
3
  namespace App\Resources\Blocks;
4
4
 
5
5
  use App\Resources\Block;
6
- use App\Contracts\Resources\Blocks\Text as TextBlockContract;
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 TextBlockContract
10
+ class ImageBlock extends Block implements ImageBlockContract
11
11
  {
12
12
  public function image(): ?ImageContract
13
13
  {
@@ -3,8 +3,8 @@
3
3
  namespace App\Resources;
4
4
 
5
5
  use Folklore\Resources\Page as BasePage;
6
+ use App\Contracts\Resources\Page as PageContract;
6
7
 
7
- class Page extends BasePage
8
+ class Page extends BasePage implements PageContract
8
9
  {
9
-
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-folklore",
3
- "version": "3.0.9",
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": "88e0fd31cded9ff974e5b50f4c76464ef26efb12"
43
+ "gitHead": "1d7f2e259b004828e208b643fb2d123aad8cc5ec"
44
44
  }