-
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.
Add new files, update existing files, and seed
data
- Loading branch information
1 parent
1ff969f
commit 46cadba
Showing
44 changed files
with
879 additions
and
468 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources; | ||
|
||
use App\Filament\Resources\StorageLocationResource\Pages; | ||
use App\Models\StorageLocation; | ||
use Filament\Forms; | ||
use Filament\Forms\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Tables; | ||
use Filament\Tables\Table; | ||
|
||
class StorageLocationResource extends Resource | ||
{ | ||
protected static ?string $model = StorageLocation::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\TextInput::make('name') | ||
->required(), | ||
Forms\Components\Textarea::make('description') | ||
->columnSpanFull(), | ||
Forms\Components\Textarea::make('looseInventory') | ||
->columnSpanFull(), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
Tables\Columns\TextColumn::make('created_at') | ||
->dateTime() | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: true), | ||
Tables\Columns\TextColumn::make('updated_at') | ||
->dateTime() | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: true), | ||
Tables\Columns\TextColumn::make('name') | ||
->searchable(), | ||
]) | ||
->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\ListStorageLocations::route('/'), | ||
'create' => Pages\CreateStorageLocation::route('/create'), | ||
'edit' => Pages\EditStorageLocation::route('/{record}/edit'), | ||
]; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
app/Filament/Resources/StorageLocationResource/Pages/CreateStorageLocation.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,11 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\StorageLocationResource\Pages; | ||
|
||
use App\Filament\Resources\StorageLocationResource; | ||
use Filament\Resources\Pages\CreateRecord; | ||
|
||
class CreateStorageLocation extends CreateRecord | ||
{ | ||
protected static string $resource = StorageLocationResource::class; | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/StorageLocationResource/Pages/EditStorageLocation.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\StorageLocationResource\Pages; | ||
|
||
use App\Filament\Resources\StorageLocationResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\EditRecord; | ||
|
||
class EditStorageLocation extends EditRecord | ||
{ | ||
protected static string $resource = StorageLocationResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\DeleteAction::make(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/StorageLocationResource/Pages/ListStorageLocations.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\StorageLocationResource\Pages; | ||
|
||
use App\Filament\Resources\StorageLocationResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
class ListStorageLocations extends ListRecords | ||
{ | ||
protected static string $resource = StorageLocationResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::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
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,30 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\StorageLocation; | ||
use Illuminate\View\View; | ||
|
||
class StorageLocationController extends Controller | ||
{ | ||
public function index(): View | ||
{ | ||
return view('templates.storageLocation.index', | ||
['storageLocations' => StorageLocation::all()] | ||
); | ||
} | ||
|
||
public function show(StorageLocation $storageLocation): View | ||
{ | ||
return view('templates.storageLocation.show', | ||
['storageLocation' => $storageLocation] | ||
); | ||
} | ||
|
||
public function print(StorageLocation $storageLocation): View | ||
{ | ||
return view('templates.storageLocation.print', | ||
['storageLocation' => $storageLocation] | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use App\Traits\AutoLoginLinkTrait; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Relations\HasMany; | ||
|
||
class StorageLocation extends Model | ||
{ | ||
use AutoLoginLinkTrait; | ||
use HasFactory; | ||
|
||
protected $fillable = [ | ||
'name', | ||
'description', | ||
'looseInventory', | ||
]; | ||
|
||
public function items(): HasMany | ||
{ | ||
return $this->hasMany(Item::class); | ||
} | ||
|
||
protected function getRouteName(): string | ||
{ | ||
return 'storageLocation.show'; | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Traits; | ||
|
||
trait AutoLoginLinkTrait | ||
{ | ||
public function getAutoLoginLink(): string | ||
{ | ||
return str_replace('://', '://'.config('app.autoLoginCredentials').'@', route($this->getRouteName(), $this->id)); | ||
} | ||
|
||
abstract protected function getRouteName(): string; | ||
} |
Oops, something went wrong.