Skip to content

Commit 439e13a

Browse files
authored
Merge pull request #7 from RealMrHex/fix-stub-issue
fix: Stub not found issue
2 parents 73402b2 + 973a24f commit 439e13a

19 files changed

+290
-1
lines changed

.gitignore

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
/.phpunit.cache
55
/.php-cs-fixer.cache
66
/.phpunit.result.cache
7-
/.phpunit.cache
7+
/.phpunit.cache
8+
composer.lock

.php-cs-fixer.php

100644100755
File mode changed.

LICENCE

100644100755
File mode changed.

phpunit.xml

100644100755
File mode changed.

stubs/ChartWidget.stub

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use Filament\Widgets\{{ chart }}Widget;
6+
7+
class {{ class }} extends {{ chart }}Widget
8+
{
9+
protected static ?string $heading = 'Chart';
10+
11+
protected function getData(): array
12+
{
13+
return [
14+
//
15+
];
16+
}
17+
}

stubs/CustomResourcePage.stub

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use {{ resource }};
6+
use {{ baseResourcePage }};
7+
8+
class {{ resourcePageClass }} extends {{ baseResourcePageClass }}
9+
{
10+
protected static string $resource = {{ resourceClass }}::class;
11+
12+
protected static string $view = '{{ view }}';
13+
}

stubs/Page.stub

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use Filament\Pages\Page;
6+
7+
class {{ class }} extends Page
8+
{
9+
protected static ?string $navigationIcon = 'heroicon-o-document-text';
10+
11+
protected static string $view = '{{ view }}';
12+
}

stubs/PageView.stub

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<x-filament::page>
2+
3+
</x-filament::page>

stubs/RelationManager.stub

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use Filament\Forms;
6+
use Filament\Resources\Form;
7+
use Filament\Resources\RelationManagers\RelationManager;
8+
use Filament\Resources\Table;
9+
use Filament\Tables;
10+
use Illuminate\Database\Eloquent\Builder;
11+
use Illuminate\Database\Eloquent\SoftDeletingScope;
12+
13+
class {{ managerClass }} extends RelationManager
14+
{
15+
protected static string $relationship = '{{ relationship }}';
16+
17+
protected static ?string $recordTitleAttribute = '{{ recordTitleAttribute }}';
18+
19+
public static function form(Form $form): Form
20+
{
21+
return $form
22+
->schema([
23+
Forms\Components\TextInput::make('{{ recordTitleAttribute }}')
24+
->required()
25+
->maxLength(255),
26+
]);
27+
}
28+
29+
public static function table(Table $table): Table
30+
{
31+
return $table
32+
->columns([
33+
Tables\Columns\TextColumn::make('{{ recordTitleAttribute }}'),
34+
])
35+
->filters([
36+
{{ tableFilters }}
37+
])
38+
->headerActions([
39+
{{ tableHeaderActions }}
40+
])
41+
->actions([
42+
{{ tableActions }}
43+
])
44+
->bulkActions([
45+
{{ tableBulkActions }}
46+
]);
47+
}{{ eloquentQuery }}
48+
}

stubs/Resource.stub

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use {{ resource }}\Pages;
6+
use {{ resource }}\RelationManagers;
7+
use App\Models\{{ model }};
8+
use Filament\Forms;
9+
use Filament\Resources\Form;
10+
use Filament\Resources\Resource;
11+
use Filament\Resources\Table;
12+
use Filament\Tables;
13+
use Illuminate\Database\Eloquent\Builder;
14+
use Illuminate\Database\Eloquent\SoftDeletingScope;
15+
16+
class {{ resourceClass }} extends Resource
17+
{
18+
protected static ?string $model = {{ modelClass }}::class;
19+
20+
protected static ?string $navigationIcon = 'heroicon-o-collection';
21+
22+
public static function form(Form $form): Form
23+
{
24+
return $form
25+
->schema([
26+
{{ formSchema }}
27+
]);
28+
}
29+
30+
public static function table(Table $table): Table
31+
{
32+
return $table
33+
->columns([
34+
{{ tableColumns }}
35+
])
36+
->filters([
37+
{{ tableFilters }}
38+
])
39+
->actions([
40+
{{ tableActions }}
41+
])
42+
->bulkActions([
43+
{{ tableBulkActions }}
44+
]);
45+
}
46+
{{ relations }}
47+
public static function getPages(): array
48+
{
49+
return [
50+
{{ pages }}
51+
];
52+
}{{ eloquentQuery }}
53+
}

0 commit comments

Comments
 (0)