Skip to content

Commit

Permalink
fix some array bracket styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Herbert Maschke committed Nov 8, 2022
1 parent fa9b4b7 commit db59909
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 179 deletions.
18 changes: 8 additions & 10 deletions database/migrations/2022_07_04_104832_add_indices_to_posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
return new class extends Migration
{
public function up()
{
Schema::table(
'posts',
function (Blueprint $table) {
$table->index('title');
$table->index('slug');
$table->index('description');
$table->fullText('content');
}
);
Schema::table('posts', function (Blueprint $table) {
$table->index('title');
$table->index('slug');
$table->index('description');
$table->fullText('content');
});
}
};
25 changes: 10 additions & 15 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,18 @@

Route::prefix(config('zeus-sky.path'))
->middleware(config('zeus-sky.middleware'))
->group(
function () {
Route::get('/', Posts::class)->name('blogs');
Route::get(config('zeus-sky.post_uri_prefix') . '/{slug}', Post::class)->name('post');
Route::get(config('zeus-sky.page_uri_prefix') . '/{slug}', Page::class)->name('page');
Route::get('{type}/{slug}', Tags::class)->name('tags');
->group(function () {
Route::get('/', Posts::class)->name('blogs');
Route::get(config('zeus-sky.post_uri_prefix') . '/{slug}', Post::class)->name('post');
Route::get(config('zeus-sky.page_uri_prefix') . '/{slug}', Page::class)->name('page');
Route::get('{type}/{slug}', Tags::class)->name('tags');

Route::get(
'passConf',
function () {
session()->put(request('postID') . '-' . request('password'), request('password'));
Route::get('passConf', function () {
session()->put(request('postID') . '-' . request('password'), request('password'));

return redirect()->back()->with('status', 'sorry, password incorrect!');
}
);
}
);
return redirect()->back()->with('status', 'sorry, password incorrect!');
});
});

if (in_array('LaraZeus\Sky\Filament\Resources\FaqResource', config('zeus-sky.enabled_resources'))) {
Route::get(config('zeus-sky.faq_uri_prefix') . '', Faq::class)->name('faq');
Expand Down
12 changes: 4 additions & 8 deletions src/Filament/Resources/FaqResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ protected static function getNavigationLabel(): string
public static function form(Form $form): Form
{
return $form
->schema(
[
->schema([
Textarea::make('question')
->label(__('Question'))
->required()
Expand All @@ -57,18 +56,15 @@ public static function form(Form $form): Form
->required()
->maxLength(65535)
->columnSpan(2),
]
);
]);
}

public static function table(Table $table): Table
{
return $table
->columns(
[
->columns([
TextColumn::make('question'),
]
);
]);
}

public static function getPages(): array
Expand Down
62 changes: 21 additions & 41 deletions src/Filament/Resources/PageResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,38 +41,29 @@ protected static function getNavigationBadge(): ?string
public static function form(Form $form): Form
{
return $form
->schema(
[
Grid::make()->schema(
[
Card::make()->schema(
[
->schema([
Grid::make()->schema([
Card::make()->schema([
TextInput::make('title')
->label(__('Post Title'))
->required()
->maxLength(255)
->reactive()
->afterStateUpdated(
function (Closure $set, $state) {
$set('slug', Str::slug($state));
}
),
->afterStateUpdated(function (Closure $set, $state) {
$set('slug', Str::slug($state));
}),

TinyEditor::make('content')
->label(__('Post Content'))
->showMenuBar()
->required(),
]
),
]
)
]),
])
->columnSpan(3),

Grid::make()->schema(
[
Grid::make()->schema([
Section::make(__('SEO'))
->description(__('SEO Settings'))->schema(
[
->description(__('SEO Settings'))->schema([
Hidden::make('user_id')
->required()
->default(auth()->user()->id),
Expand Down Expand Up @@ -100,14 +91,12 @@ function (Closure $set, $state) {
->integer()
->label(__('Page Order'))
->default(1),
]
)
])
->collapsible(),

Section::make(__('visibility'))
->description(__('Visibility Options'))
->schema(
[
->schema([
Select::make('status')
->label(__('status'))
->default('publish')
Expand All @@ -123,30 +112,24 @@ function (Closure $set, $state) {
DateTimePicker::make('published_at')
->label(__('published at'))
->default(now()),
]
)
])
->collapsible(),

Section::make(__('Featured Image'))
->schema(
[
->schema([
SpatieMediaLibraryFileUpload::make('featured_image')
->collection('pages')
->label(''),
]
)
])
->collapsible(),
]
)->columnSpan(1),
]
)->columns(4);
])->columnSpan(1),
])->columns(4);
}

public static function table(Table $table): Table
{
return $table
->columns(
[
->columns([
ViewColumn::make('title_card')
->label(__('Title'))
->sortable(['title'])
Expand All @@ -159,20 +142,17 @@ public static function table(Table $table): Table
->searchable(['status'])
->view('zeus-sky::filament.columns.status-desc')
->tooltip(fn (Post $record): string => $record->published_at->format('Y/m/d | H:i A')),
]
)
])
->defaultSort('id', 'desc')
->filters(
[
->filters([
MultiSelectFilter::make('status')
->label(__('Status'))
->options(PostStatus::pluck('label', 'name')),

Filter::make('password')
->label(__('Password Protected'))
->query(fn (Builder $query): Builder => $query->whereNotNull('password')),
]
);
]);
}

public static function getPages(): array
Expand Down
68 changes: 23 additions & 45 deletions src/Filament/Resources/PostResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,38 +41,29 @@ protected static function getNavigationBadge(): ?string
public static function form(Form $form): Form
{
return $form
->schema(
[
Grid::make()->schema(
[
Card::make()->schema(
[
->schema([
Grid::make()->schema([
Card::make()->schema([
TextInput::make('title')
->label(__('Post Title'))
->required()
->maxLength(255)
->reactive()
->afterStateUpdated(
function (Closure $set, $state) {
$set('slug', Str::slug($state));
}
),
->afterStateUpdated(function (Closure $set, $state) {
$set('slug', Str::slug($state));
}),

TinyEditor::make('content')
->label(__('Post Content'))
->showMenuBar()
->required(),
]
),
]
)->columnSpan(3),
]),
])->columnSpan(3),

Grid::make()->schema(
[
Grid::make()->schema([
Section::make(__('SEO'))
->description(__('SEO Settings'))
->schema(
[
->schema([
Hidden::make('user_id')
->default(auth()->user()->id)
->required(),
Expand All @@ -91,29 +82,25 @@ function (Closure $set, $state) {
->required()
->maxLength(255)
->label(__('Post Slug')),
]
)
])
->collapsible(),

Section::make(__('Tags and Categories'))
->description(__('Tags and Categories Options'))
->schema(
[
->schema([
SpatieTagsInput::make('tags')
->type('tag')
->label(__('Tags')),

SpatieTagsInput::make('category')
->type('category')
->label(__('Categories')),
]
)
])
->collapsible(),

Section::make(__('visibility'))
->description(__('Visibility Options'))
->schema(
[
->schema([
Select::make('status')
->label(__('status'))
->default('publish')
Expand All @@ -132,30 +119,24 @@ function (Closure $set, $state) {

DateTimePicker::make('sticky_until')
->label(__('Sticky Until')),
]
)
])
->collapsible(),

Section::make(__('Featured Image'))
->schema(
[
->schema([
SpatieMediaLibraryFileUpload::make('featured_image')
->collection('posts')
->label(''),
]
)
])
->collapsible(),
]
)->columnSpan(1),
]
)->columns(4);
])->columnSpan(1),
])->columns(4);
}

public static function table(Table $table): Table
{
return $table
->columns(
[
->columns([
ViewColumn::make('title_card')
->label(__('Title'))
->sortable(['title'])
Expand All @@ -176,11 +157,9 @@ public static function table(Table $table): Table
SpatieTagsColumn::make('category')
->label(__('Post Category'))
->type('category'),
]
)
])
->defaultSort('id', 'desc')
->filters(
[
->filters([
MultiSelectFilter::make('status')
->label(__('Status'))
->options(PostStatus::pluck('label', 'name')),
Expand Down Expand Up @@ -212,8 +191,7 @@ public static function table(Table $table): Table
MultiSelectFilter::make('tags')
->relationship('tags', 'name')
->label(__('Tags')),
]
);
]);
}

public static function getPages(): array
Expand Down
Loading

0 comments on commit db59909

Please sign in to comment.