generated from vormkracht10/filament-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9034c1a
commit d7844ff
Showing
7 changed files
with
158 additions
and
22 deletions.
There are no files selected for viewing
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 was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
database/migrations/create_redirects_table_filament.php.stub
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,23 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::create('redirects', function (Blueprint $table) { | ||
$table->foreignUlid('site_ulid')->nullable()->constrained(table: 'sites', column: 'ulid')->cascadeOnUpdate()->cascadeOnDelete()->after('ulid'); | ||
$table->char('language_code', 2)->nullable()->after('site_ulid'); | ||
$table->char('country_code', 2)->nullable()->after('language_code'); | ||
$table->foreignUlid('content_ulid')->nullable()->constrained(table: 'content', column: 'ulid')->cascadeOnUpdate()->cascadeOnDelete()->after('path'); | ||
|
||
$table->foreign(['language_code', 'country_code'])->references(['code', 'country_code'])->on('languages')->cascadeOnUpdate()->nullOnDelete(); | ||
}); | ||
} | ||
}; |
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,73 @@ | ||
<?php | ||
|
||
namespace Vormkracht10\FilamentRedirects\Resources; | ||
|
||
use Filament\Forms\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Tables; | ||
use Filament\Tables\Columns\TextColumn; | ||
use Filament\Tables\Table; | ||
use Vormkracht10\Redirects\Models\Redirect; | ||
use Vormkracht10\Backstage\Resources\RedirectResource\Pages; | ||
|
||
class RedirectResource extends Resource | ||
{ | ||
protected static ?string $model = Redirect::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-arrows-right-left'; | ||
|
||
public static ?string $recordTitleAttribute = 'name'; | ||
|
||
public static function getModelLabel(): string | ||
{ | ||
return __('Redirect'); | ||
} | ||
|
||
public static function getPluralModelLabel(): string | ||
{ | ||
return __('Redirects'); | ||
} | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
TextColumn::make('path') | ||
->searchable() | ||
->sortable(), | ||
]) | ||
->filters([ | ||
// | ||
]) | ||
->actions([ | ||
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\ListRedirects::route('/'), | ||
'create' => Pages\CreateRedirect::route('/create'), | ||
'edit' => Pages\EditRedirect::route('/{record}/edit'), | ||
]; | ||
} | ||
} |
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,11 @@ | ||
<?php | ||
|
||
namespace Vormkracht10\FilamentRedirects\Resources\RedirectResource\Pages; | ||
|
||
use Filament\Resources\Pages\CreateRecord; | ||
use Vormkracht10\Backstage\Resources\RedirectResource; | ||
|
||
class CreateRedirect extends CreateRecord | ||
{ | ||
protected static string $resource = RedirectResource::class; | ||
} |
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 Vormkracht10\FilamentRedirects\Resources\RedirectResource\Pages; | ||
|
||
use Filament\Actions; | ||
use Filament\Resources\Pages\EditRecord; | ||
use Vormkracht10\Backstage\Resources\RedirectResource; | ||
|
||
class EditRedirect extends EditRecord | ||
{ | ||
protected static string $resource = RedirectResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\DeleteAction::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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Vormkracht10\FilamentRedirects\Resources\RedirectResource\Pages; | ||
|
||
use Filament\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
use Vormkracht10\Backstage\Resources\RedirectResource; | ||
|
||
class ListRedirects extends ListRecords | ||
{ | ||
protected static string $resource = RedirectResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::make(), | ||
]; | ||
} | ||
} |