-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
29 changed files
with
343 additions
and
124 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
55 changes: 55 additions & 0 deletions
55
app/Filament/Resources/Atom/ArticleResource/RelationManagers/TagsRelationManager.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,55 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\Atom\ArticleResource\RelationManagers; | ||
|
||
use Filament\Forms; | ||
use Filament\Tables; | ||
use Filament\Forms\Form; | ||
use Filament\Tables\Table; | ||
use App\Filament\Resources\Atom\TagResource; | ||
use App\Filament\Traits\TranslatableResource; | ||
use Filament\Resources\RelationManagers\RelationManager; | ||
|
||
class TagsRelationManager extends RelationManager | ||
{ | ||
use TranslatableResource; | ||
|
||
protected static string $relationship = 'tags'; | ||
|
||
protected static ?string $recordTitleAttribute = 'name'; | ||
|
||
public static string $translateIdentifier = 'tags'; | ||
|
||
public function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\TextInput::make('name') | ||
->required() | ||
->maxLength(255), | ||
]); | ||
} | ||
|
||
public function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns(TagResource::getTable()) | ||
->modifyQueryUsing(fn ($query) => $query->latest()) | ||
->filters([ | ||
// | ||
]) | ||
->headerActions([ | ||
Tables\Actions\CreateAction::make() | ||
->form(TagResource::getForm()), | ||
|
||
Tables\Actions\AttachAction::make()->preloadRecordSelect() | ||
]) | ||
->actions([ | ||
Tables\Actions\ViewAction::make(), | ||
Tables\Actions\DetachAction::make(), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\DetachBulkAction::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,84 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\Atom; | ||
|
||
use Filament\Tables; | ||
use Filament\Forms\Components\Toggle; | ||
use Filament\Forms\Form; | ||
use Filament\Tables\Table; | ||
use App\Filament\Resources\Atom\FotoResource\Pages; | ||
use Filament\Resources\Resource; | ||
use Filament\Tables\Columns\ImageColumn; | ||
use Filament\Tables\Columns\TextColumn; | ||
use Filament\Tables\Columns\ToggleColumn; | ||
use App\Models\Camera; | ||
|
||
class FotoResource extends Resource | ||
{ | ||
protected static ?string $model = Camera::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-photo'; | ||
|
||
protected static ?string $navigationGroup = 'Website'; | ||
|
||
protected static ?string $navigationLabel = 'Web Camera'; | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Toggle::make('visible') | ||
->label(__('Visible')) | ||
->default(true), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->defaultSort('id', 'desc') | ||
->columns([ | ||
TextColumn::make('id') | ||
->label(__('filament::resources.columns.id')) | ||
->sortable(), | ||
TextColumn::make('user_id') | ||
->label(__('filament::resources.columns.user_id')), | ||
TextColumn::make('room_id') | ||
->label(__('filament::resources.columns.room_id')), | ||
TextColumn::make('timestamp') | ||
->label(__('filament::resources.columns.created_at')) | ||
->dateTime(), | ||
ImageColumn::make('url') | ||
->label(__('filament::resources.columns.image')) | ||
->extraAttributes(['style' => 'image-rendering: pixelated']) | ||
->size(125), | ||
ToggleColumn::make('visible') | ||
->label(__('Visible')) | ||
]) | ||
->actions([ | ||
Tables\Actions\DeleteAction::make(), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\DeleteBulkAction::make(), | ||
]); | ||
} | ||
|
||
public static function getRelations(): array | ||
{ | ||
return [ | ||
]; | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListFotos::route('/'), | ||
'edit' => Pages\EditFoto::route('/{record}/edit'), | ||
]; | ||
} | ||
|
||
public static function canCreate(): bool | ||
{ | ||
return false; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/Atom/FotoResource/Pages/EditFoto.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\Resources\Atom\FotoResource\Pages; | ||
|
||
use App\Filament\Resources\Atom\FotoResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\EditRecord; | ||
|
||
class EditFoto extends EditRecord | ||
{ | ||
protected static string $resource = FotoResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\DeleteAction::make(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/Atom/FotoResource/Pages/ListFotos.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\Resources\Atom\FotoResource\Pages; | ||
|
||
use App\Filament\Resources\Atom\FotoResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
class ListFotos extends ListRecords | ||
{ | ||
protected static string $resource = FotoResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::make(), | ||
]; | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...ilament/Resources/CatalogPageResource.php → ...t/Resources/Hotel/CatalogPageResource.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
...gPageResource/Pages/CreateCatalogPage.php → ...gPageResource/Pages/CreateCatalogPage.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
...logPageResource/Pages/EditCatalogPage.php → ...logPageResource/Pages/EditCatalogPage.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
...ogPageResource/Pages/ListCatalogPages.php → ...ogPageResource/Pages/ListCatalogPages.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
2 changes: 1 addition & 1 deletion
2
...nManagers/CatalogItemsRelationManager.php → ...nManagers/CatalogItemsRelationManager.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
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
28 changes: 28 additions & 0 deletions
28
database/migrations/2024_12_22_201248_create_tagable_table.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,28 @@ | ||
<?php | ||
|
||
use App\Models\Articles\Tag; | ||
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('taggables', function (Blueprint $table) { | ||
$table->foreignIdFor(Tag::class); | ||
$table->morphs('taggable'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('taggables'); | ||
} | ||
}; |
22 changes: 22 additions & 0 deletions
22
database/migrations/2024_12_24_100950_add_visible_to_camera_web_table.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,22 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class AddVisibleToCameraWebTable extends Migration | ||
{ | ||
public function up() | ||
{ | ||
Schema::table('camera_web', function (Blueprint $table) { | ||
$table->boolean('visible')->default(true); | ||
}); | ||
} | ||
|
||
public function down() | ||
{ | ||
Schema::table('camera_web', function (Blueprint $table) { | ||
$table->dropColumn('visible'); | ||
}); | ||
} | ||
} |
Oops, something went wrong.