Skip to content

Commit

Permalink
Merge pull request #3 from lara-zeus/analysis-WNBGKe
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
atmonshi authored Apr 19, 2022
2 parents e84a10b + 904341b commit 2fcdb95
Show file tree
Hide file tree
Showing 22 changed files with 92 additions and 94 deletions.
16 changes: 8 additions & 8 deletions config/zeus-sky.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@

return [
/**
* set the default path for the blogs homepage
* set the default path for the blogs homepage.
*/
'path' => 'blog',

/**
* the middleware you want to apply on all the blogs routes
* for example if you want to make your blog for users only, add the middleware 'auth'
* for example if you want to make your blog for users only, add the middleware 'auth'.
*/
'middleware' => ['web'],

/**
* this will be setup the default seo site title. read more about it in 'laravel-seo'
* this will be setup the default seo site title. read more about it in 'laravel-seo'.
*/
'site_title' => config('app.name', 'Laravel').' | Blogs',

/**
* this will be setup the default seo site description. read more about it in 'laravel-seo'
* this will be setup the default seo site description. read more about it in 'laravel-seo'.
*/
'site_description' => 'All about '.config('app.name', 'Laravel').' Blogs',

/**
* this will be setup the default seo site color theme. read more about it in 'laravel-seo'
* this will be setup the default seo site color theme. read more about it in 'laravel-seo'.
*/
'site_color' => '#F5F5F4',

/**
* you can use the default layout as a starting point for your blog.
* however, if you're already using your own component, just set the path here
* however, if you're already using your own component, just set the path here.
*/
'layout' => 'zeus::components.app',

Expand All @@ -41,5 +41,5 @@
/**
* available locales, this currently used only in tags manager.
*/
'translatable_Locales' => ['en','ar'],
'translatable_Locales' => ['en', 'ar'],
];
2 changes: 1 addition & 1 deletion database/factories/PostFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function definition()
'description' => $this->faker->sentence,
'content' => $this->faker->sentence,
'published_at' => now(),
'post_type' => $this->faker->randomElement([ 'page', 'post' ]),
'post_type' => $this->faker->randomElement(['page', 'post']),
];
}
}
8 changes: 4 additions & 4 deletions database/seeders/SkySeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ class SkySeeder extends Seeder
{
public function run()
{
Tag::create([ 'name' => 'laravel', 'type' => 'category' ]);
Tag::create([ 'name' => 'talks', 'type' => 'category' ]);
Tag::create([ 'name' => 'dev', 'type' => 'category' ]);
Tag::create(['name' => 'laravel', 'type' => 'category']);
Tag::create(['name' => 'talks', 'type' => 'category']);
Tag::create(['name' => 'dev', 'type' => 'category']);

Post::factory()
->count(8)
->create();

foreach (Post::all() as $post) { // loop through all posts
$random_tags = Tag::all()->random(1)->first()->name;
$post->syncTagsWithType([ $random_tags ], 'category');
$post->syncTagsWithType([$random_tags], 'category');
}
}
}
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Route::get('{type}/{slug}', \LaraZeus\Sky\Http\Livewire\Tags::class)->name('tags');

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

return redirect()->back()->with('status', 'sorry, password incorrect!');
});
Expand Down
28 changes: 14 additions & 14 deletions src/Filament/Resources/PageResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PageResource extends Resource
protected static ?string $slug = 'pages';
protected static ?string $navigationIcon = 'iconpark-folder-o';

public static function form(Form $form) : Form
public static function form(Form $form): Form
{
return $form
->schema([
Expand Down Expand Up @@ -75,7 +75,7 @@ public static function form(Form $form) : Form
->reactive()
->options(PostStatus::pluck('label', 'name')),
TextInput::make('password')->label(__('Password'))->reactive()
->visible(fn(Closure $get) : bool => $get('status') === 'private'),
->visible(fn (Closure $get): bool => $get('status') === 'private'),
DateTimePicker::make('published_at')->label(__('published at'))->default(now()),
])
->collapsible(),
Expand All @@ -89,33 +89,33 @@ public static function form(Form $form) : Form
])->columns(4);
}

public static function table(Table $table) : Table
public static function table(Table $table): Table
{
return $table
->columns([
ViewColumn::make('title_card')
->label(__('Title'))
->sortable([ 'title' ])
->searchable([ 'title' ])
->sortable(['title'])
->searchable(['title'])
->view('zeus-sky::filament.columns.page-title'),

ViewColumn::make('status_desc')
->label(__('Status'))
->sortable([ 'status' ])
->searchable([ 'status' ])
->sortable(['status'])
->searchable(['status'])
->view('zeus-sky::filament.columns.status-desc')
->tooltip(fn(Post $record) : string => $record->published_at->format('Y/m/d | H:i A')),
->tooltip(fn (Post $record): string => $record->published_at->format('Y/m/d | H:i A')),
])
->defaultSort('id', 'desc')
->filters([
MultiSelectFilter::make('status')->options(PostStatus::pluck('label', 'name')),

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

public static function getPages() : array
public static function getPages(): array
{
return [
'index' => Pages\ListPosts::route('/'),
Expand All @@ -124,22 +124,22 @@ public static function getPages() : array
];
}

public static function getLabel() : string
public static function getLabel(): string
{
return __('Page');
}

public static function getPluralLabel() : string
public static function getPluralLabel(): string
{
return __('Pages');
}

protected static function getNavigationLabel() : string
protected static function getNavigationLabel(): string
{
return __('Pages');
}

protected static function getNavigationGroup() : ?string
protected static function getNavigationGroup(): ?string
{
return __('Sky');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Resources/PageResource/Pages/CreatePost.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace LaraZeus\Sky\Filament\Resources\PageResource\Pages;

use LaraZeus\Sky\Filament\Resources\PageResource;
use Filament\Resources\Pages\CreateRecord;
use LaraZeus\Sky\Filament\Resources\PageResource;

class CreatePost extends CreateRecord
{
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Resources/PageResource/Pages/EditPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace LaraZeus\Sky\Filament\Resources\PageResource\Pages;

use LaraZeus\Sky\Filament\Resources\PageResource;
use Filament\Resources\Pages\EditRecord;
use LaraZeus\Sky\Filament\Resources\PageResource;

class EditPost extends EditRecord
{
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Resources/PageResource/Pages/ListPosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace LaraZeus\Sky\Filament\Resources\PageResource\Pages;

use Filament\Resources\Pages\ListRecords;
use Illuminate\Database\Eloquent\Builder;
use LaraZeus\Sky\Filament\Resources\PageResource;
use Filament\Resources\Pages\ListRecords;
use LaraZeus\Sky\Models\Post;

class ListPosts extends ListRecords
Expand Down
34 changes: 17 additions & 17 deletions src/Filament/Resources/PostResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PostResource extends Resource
protected static ?string $model = Post::class;
protected static ?string $navigationIcon = 'iconpark-docdetail-o';

public static function form(Form $form) : Form
public static function form(Form $form): Form
{
return $form
->schema([
Expand Down Expand Up @@ -82,7 +82,7 @@ public static function form(Form $form) : Form
->reactive()
->options(PostStatus::pluck('label', 'name')),
TextInput::make('password')->label(__('Password'))->reactive()
->visible(fn(Closure $get) : bool => $get('status') === 'private'),
->visible(fn (Closure $get): bool => $get('status') === 'private'),
DateTimePicker::make('published_at')->label(__('published at'))->default(now()),
DateTimePicker::make('sticky_until')->label(__('Sticky Until')),
])
Expand All @@ -97,22 +97,22 @@ public static function form(Form $form) : Form
])->columns(4);
}

public static function table(Table $table) : Table
public static function table(Table $table): Table
{
return $table
->columns([
ViewColumn::make('title_card')
->label(__('Title'))
->sortable([ 'title' ])
->searchable([ 'title' ])
->sortable(['title'])
->searchable(['title'])
->view('zeus-sky::filament.columns.post-title'),

ViewColumn::make('status_desc')
->label(__('Status'))
->sortable([ 'status' ])
->searchable([ 'status' ])
->sortable(['status'])
->searchable(['status'])
->view('zeus-sky::filament.columns.status-desc')
->tooltip(fn(Post $record) : string => $record->published_at->format('Y/m/d | H:i A')),
->tooltip(fn (Post $record): string => $record->published_at->format('Y/m/d | H:i A')),

SpatieTagsColumn::make('tags')->label(__('Post Tags'))->type('tag'),
SpatieTagsColumn::make('category')->label(__('Post Category'))->type('category'),
Expand All @@ -122,19 +122,19 @@ public static function table(Table $table) : Table
MultiSelectFilter::make('status')->options(PostStatus::pluck('label', 'name')),

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

Filter::make('sticky')->label(__('Still Sticky'))
->query(fn(Builder $query) : Builder => $query->sticky()),
->query(fn (Builder $query): Builder => $query->sticky()),

Filter::make('not_sticky')->label(__('Not Sticky'))
->query(fn(Builder $query) : Builder => $query
->query(fn (Builder $query): Builder => $query
->whereDate('sticky_until', '<=', now())
->orWhereNull('sticky_until')
),

Filter::make('sticky_only')->label(__('Sticky Only'))
->query(fn(Builder $query) : Builder => $query
->query(fn (Builder $query): Builder => $query
->wherePostType('post')
->whereNotNull('sticky_until')
),
Expand All @@ -143,7 +143,7 @@ public static function table(Table $table) : Table
]);
}

public static function getPages() : array
public static function getPages(): array
{
return [
'index' => Pages\ListPosts::route('/'),
Expand All @@ -152,22 +152,22 @@ public static function getPages() : array
];
}

public static function getLabel() : string
public static function getLabel(): string
{
return __('Post');
}

public static function getPluralLabel() : string
public static function getPluralLabel(): string
{
return __('Posts');
}

protected static function getNavigationLabel() : string
protected static function getNavigationLabel(): string
{
return __('Posts');
}

protected static function getNavigationGroup() : ?string
protected static function getNavigationGroup(): ?string
{
return __('Sky');
}
Expand Down
4 changes: 2 additions & 2 deletions src/Filament/Resources/PostResource/Pages/CreatePost.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace LaraZeus\Sky\Filament\Resources\PostResource\Pages;

use LaraZeus\Sky\Filament\Resources\PostResource;
use Filament\Resources\Pages\CreateRecord;
use LaraZeus\Sky\Filament\Resources\PostResource;

class CreatePost extends CreateRecord
{
protected static string $resource = PostResource::class;
}
}
4 changes: 2 additions & 2 deletions src/Filament/Resources/PostResource/Pages/EditPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace LaraZeus\Sky\Filament\Resources\PostResource\Pages;

use LaraZeus\Sky\Filament\Resources\PostResource;
use Filament\Resources\Pages\EditRecord;
use LaraZeus\Sky\Filament\Resources\PostResource;

class EditPost extends EditRecord
{
protected static string $resource = PostResource::class;
}
}
2 changes: 1 addition & 1 deletion src/Filament/Resources/PostResource/Pages/ListPosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace LaraZeus\Sky\Filament\Resources\PostResource\Pages;

use Filament\Resources\Pages\ListRecords;
use Illuminate\Database\Eloquent\Builder;
use LaraZeus\Sky\Filament\Resources\PostResource;
use Filament\Resources\Pages\ListRecords;
use LaraZeus\Sky\Models\Post;

class ListPosts extends ListRecords
Expand Down
Loading

0 comments on commit 2fcdb95

Please sign in to comment.