-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Filament clusters for Settings and Networking; implement resource…
… pages for Phone, Comment, and Newsletter
- Loading branch information
1 parent
efc9326
commit 9ea50c0
Showing
38 changed files
with
959 additions
and
147 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Filament\Clusters; | ||
|
||
use Filament\Clusters\Cluster; | ||
|
||
class Networking extends Cluster | ||
{ | ||
protected static ?string $navigationIcon = 'heroicon-o-share'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...s/CommentResource/Pages/CreateComment.php → ...s/CommentResource/Pages/CreateComment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ces/CommentResource/Pages/EditComment.php → ...ces/CommentResource/Pages/EditComment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...es/CommentResource/Pages/ListComments.php → ...es/CommentResource/Pages/ListComments.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ces/CommentResource/Pages/ViewComment.php → ...ces/CommentResource/Pages/ViewComment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
app/Filament/Clusters/Networking/Resources/NewsletterResource.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
|
||
namespace App\Filament\Clusters\Networking\Resources; | ||
|
||
use App\Filament\Clusters\Networking; | ||
use App\Filament\Clusters\Networking\Resources\NewsletterResource\Pages; | ||
use App\Filament\Clusters\Networking\Resources\NewsletterResource\RelationManagers; | ||
use App\Models\Newsletter; | ||
use Filament\Forms; | ||
use Filament\Forms\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Tables; | ||
use Filament\Tables\Table; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Database\Eloquent\SoftDeletingScope; | ||
|
||
class NewsletterResource extends Resource | ||
{ | ||
protected static ?string $model = Newsletter::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-inbox-arrow-down'; | ||
|
||
protected static ?string $cluster = Networking::class; | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\TextInput::make('email') | ||
->email() | ||
->required() | ||
->maxLength(255), | ||
Forms\Components\Toggle::make('is_subscribed') | ||
->required(), | ||
Forms\Components\DateTimePicker::make('subscribed_at'), | ||
Forms\Components\DateTimePicker::make('unsubscribed_at'), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
Tables\Columns\TextColumn::make('email') | ||
->searchable(), | ||
Tables\Columns\IconColumn::make('is_subscribed') | ||
->boolean(), | ||
Tables\Columns\TextColumn::make('subscribed_at') | ||
->dateTime() | ||
->sortable(), | ||
Tables\Columns\TextColumn::make('unsubscribed_at') | ||
->dateTime() | ||
->sortable(), | ||
Tables\Columns\TextColumn::make('deleted_at') | ||
->dateTime() | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: true), | ||
Tables\Columns\TextColumn::make('created_at') | ||
->dateTime() | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: true), | ||
Tables\Columns\TextColumn::make('updated_at') | ||
->dateTime() | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: true), | ||
]) | ||
->filters([ | ||
// | ||
]) | ||
->actions([ | ||
Tables\Actions\ViewAction::make(), | ||
Tables\Actions\EditAction::make(), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\BulkActionGroup::make([ | ||
Tables\Actions\DeleteBulkAction::make(), | ||
]), | ||
]); | ||
} | ||
|
||
public static function getRelations(): array | ||
{ | ||
return [ | ||
// | ||
]; | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListNewsletters::route('/'), | ||
'create' => Pages\CreateNewsletter::route('/create'), | ||
'view' => Pages\ViewNewsletter::route('/{record}'), | ||
'edit' => Pages\EditNewsletter::route('/{record}/edit'), | ||
]; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/Filament/Clusters/Networking/Resources/NewsletterResource/Pages/CreateNewsletter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace App\Filament\Clusters\Networking\Resources\NewsletterResource\Pages; | ||
|
||
use App\Filament\Clusters\Networking\Resources\NewsletterResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\CreateRecord; | ||
|
||
class CreateNewsletter extends CreateRecord | ||
{ | ||
protected static string $resource = NewsletterResource::class; | ||
} |
20 changes: 20 additions & 0 deletions
20
app/Filament/Clusters/Networking/Resources/NewsletterResource/Pages/EditNewsletter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace App\Filament\Clusters\Networking\Resources\NewsletterResource\Pages; | ||
|
||
use App\Filament\Clusters\Networking\Resources\NewsletterResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\EditRecord; | ||
|
||
class EditNewsletter extends EditRecord | ||
{ | ||
protected static string $resource = NewsletterResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\ViewAction::make(), | ||
Actions\DeleteAction::make(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Clusters/Networking/Resources/NewsletterResource/Pages/ListNewsletters.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Clusters\Networking\Resources\NewsletterResource\Pages; | ||
|
||
use App\Filament\Clusters\Networking\Resources\NewsletterResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
class ListNewsletters extends ListRecords | ||
{ | ||
protected static string $resource = NewsletterResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::make(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Clusters/Networking/Resources/NewsletterResource/Pages/ViewNewsletter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Clusters\Networking\Resources\NewsletterResource\Pages; | ||
|
||
use App\Filament\Clusters\Networking\Resources\NewsletterResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ViewRecord; | ||
|
||
class ViewNewsletter extends ViewRecord | ||
{ | ||
protected static string $resource = NewsletterResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\EditAction::make(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...urces/PhoneResource/Pages/CreatePhone.php → ...urces/PhoneResource/Pages/CreatePhone.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ources/PhoneResource/Pages/ListPhones.php → ...ources/PhoneResource/Pages/ListPhones.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...sources/PhoneResource/Pages/ViewPhone.php → ...sources/PhoneResource/Pages/ViewPhone.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Filament\Clusters; | ||
|
||
use Filament\Clusters\Cluster; | ||
|
||
class Settings extends Cluster | ||
{ | ||
protected static ?string $navigationIcon = 'heroicon-o-cog-8-tooth'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Filament\Clusters\Settings\Pages; | ||
|
||
use App\Filament\Clusters\Settings; | ||
use App\Settings\AboutSettings; | ||
use Filament\Forms; | ||
use Filament\Forms\Form; | ||
use Filament\Pages\SettingsPage; | ||
|
||
class ManageAbout extends SettingsPage | ||
{ | ||
protected static ?string $navigationIcon = 'heroicon-o-light-bulb'; | ||
|
||
protected static string $settings = AboutSettings::class; | ||
|
||
protected static ?string $cluster = Settings::class; | ||
|
||
public function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
// ... | ||
]); | ||
} | ||
} |
Oops, something went wrong.