Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8ba1984

Browse files
Brands data fix (#160)
1 parent ac1f4ae commit 8ba1984

5 files changed

Lines changed: 31 additions & 6 deletions

File tree

resources/blueprints/runway/brand.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,24 @@ tabs:
44
sections:
55
-
66
fields:
7+
-
8+
handle: title
9+
field:
10+
type: text
11+
required: true
12+
localizable: true
13+
-
14+
handle: slug
15+
field:
16+
type: slug
17+
localizable: true
18+
validate:
19+
- 'max:200'
20+
- 'new \Statamic\Rules\UniqueEntryValue({collection}, {id}, {site})'
721
-
822
import: page_builder
23+
-
24+
import: image
925
meta:
1026
display: Meta
1127
sections:

resources/views/page_builder/brandlist.blade.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
->where('site', \Statamic\Facades\Site::current()->handle())
55
->orderBy('title')
66
->get();
7-
8-
$grouped = $brands->groupBy(function(\Statamic\Eloquent\Entries\Entry $item, int $key) {
9-
return $item->title[0];
10-
});
117
@endphp
128

139
<div class="container mb-16">

src/Actions/ImportBrands.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
use Illuminate\Support\Facades\Storage;
1010
use Rapidez\Statamic\Actions\StatamicEntryAction;
1111
use Illuminate\Support\Facades\Schema;
12+
use Rapidez\Statamic\Contracts\ImportsBrands;
1213

13-
class ImportBrands
14+
class ImportBrands implements ImportsBrands
1415
{
1516
public function __construct(
1617
protected StatamicEntryAction $statamicEntryAction
1718
) {}
1819

19-
public function handle()
20+
public function handle(): void
2021
{
2122
foreach (Site::all() as $site) {
2223
foreach (Brand::get() as $brand) {

src/Contracts/ImportsBrands.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Rapidez\Statamic\Contracts;
4+
5+
interface ImportsBrands
6+
{
7+
public function handle(): void;
8+
}

src/RapidezStatamicServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Rapidez\Statamic\Commands\ImportBrands;
1515
use Rapidez\Statamic\Commands\InstallCommand;
1616
use Rapidez\Statamic\Commands\InvalidateCacheCommand;
17+
use Rapidez\Statamic\Contracts\ImportsBrands;
18+
use Rapidez\Statamic\Actions\ImportBrands as ImportBrandsAction;
1719
use Rapidez\Statamic\Extend\SitesLinkedToMagentoStores;
1820
use Rapidez\Statamic\Forms\JsDrivers\Vue;
1921
use Rapidez\Statamic\Http\ViewComposers\ConfigComposer;
@@ -46,6 +48,8 @@ public function register()
4648
$this->app->extend(Sites::class, fn () => new SitesLinkedToMagentoStores());
4749

4850
$this->app->singleton(RapidezStatamic::class);
51+
52+
$this->app->bind(ImportsBrands::class, ImportBrandsAction::class);
4953

5054
// Since we have our own way of exposing the globals to the view,
5155
// we can overwrite Statamic's functionality so we don't query for the

0 commit comments

Comments
 (0)