Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
lee-to authored and github-actions[bot] committed Oct 19, 2024
1 parent 3b7a94f commit b9c928a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/Casts/LayoutsCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function get(Model $model, string $key, mixed $value, array $attributes):

$data = Json::decode($attributes[$key]);

if($data instanceof LayoutItemCollection) {
if ($data instanceof LayoutItemCollection) {
return $data;
}

Expand All @@ -35,7 +35,7 @@ private function _map(mixed $value): LayoutItemCollection
$values = [];

try {
if(is_string($value) && str($value)->isJson()) {
if (is_string($value) && str($value)->isJson()) {
$value = json_decode($value, true, 512, JSON_THROW_ON_ERROR);
}

Expand Down
14 changes: 7 additions & 7 deletions src/Http/Controllers/LayoutsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
namespace MoonShine\Layouts\Http\Controllers;

use MoonShine\Laravel\Collections\Fields;
use MoonShine\Support\Enums\PageType;
use MoonShine\Support\Enums\ToastType;
use MoonShine\Laravel\Http\Controllers\MoonShineController;
use MoonShine\Laravel\Http\Responses\MoonShineJsonResponse;
use MoonShine\Laravel\MoonShineRequest;
use MoonShine\Layouts\Casts\LayoutItem;
use MoonShine\Layouts\Collections\LayoutItemCollection;
use MoonShine\Layouts\Fields\Layout;
use MoonShine\Layouts\Fields\Layouts;
use MoonShine\Laravel\MoonShineRequest;
use MoonShine\Support\Enums\PageType;
use MoonShine\Support\Enums\ToastType;
use Throwable;

final class LayoutsController extends MoonShineController
Expand All @@ -25,7 +25,7 @@ public function store(MoonShineRequest $request): MoonShineJsonResponse
{
$field = $this->getField($request);

if(is_null($field)) {
if (is_null($field)) {
return MoonShineJsonResponse::make()
->toast('Field not found', ToastType::ERROR);
}
Expand All @@ -43,7 +43,7 @@ public function store(MoonShineRequest $request): MoonShineJsonResponse
->findByName($request->get('name'))
?->removeButton($field->getRemoveButton());

if(is_null($layout)) {
if (is_null($layout)) {
return MoonShineJsonResponse::make()
->toast('Layout not found', ToastType::ERROR);
}
Expand All @@ -52,7 +52,7 @@ public function store(MoonShineRequest $request): MoonShineJsonResponse
->collect('counts')
->get($layout->name(), 0);

if($layout->hasLimit() && $layout->limit() <= $layoutCount) {
if ($layout->hasLimit() && $layout->limit() <= $layoutCount) {
return MoonShineJsonResponse::make()
->toast("Limit count {$layout->limit()}", ToastType::ERROR);
}
Expand All @@ -67,7 +67,7 @@ private function getField(MoonShineRequest $request): ?Layouts
{
$page = $request->getPage();

if(! $resource = $request->getResource()) {
if (! $resource = $request->getResource()) {
$fields = Fields::make(is_null($page->getPageType()) ? $page->components() : $page->getFields());
} else {
$fields = match ($page->getPageType()) {
Expand Down
5 changes: 2 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
namespace MoonShine\Layouts\Tests;

use Illuminate\Foundation\Testing\RefreshDatabase;
use MoonShine\Layouts\Providers\MoonShineLayoutsServiceProvider;
use MoonShine\Layouts\Tests\Fixtures\TestResource;
use MoonShine\MenuManager\MenuItem;
use MoonShine\Laravel\Models\MoonshineUser;
use MoonShine\Laravel\Models\MoonshineUserRole;
use MoonShine\Laravel\Providers\MoonShineServiceProvider;
use MoonShine\Layouts\Providers\MoonShineLayoutsServiceProvider;
use MoonShine\Layouts\Tests\Fixtures\TestResource;
use Orchestra\Testbench\TestCase as Orchestra;

abstract class TestCase extends Orchestra
Expand Down

0 comments on commit b9c928a

Please sign in to comment.