Skip to content

Commit

Permalink
fix: Stub not found issue
Browse files Browse the repository at this point in the history
  • Loading branch information
RealMrHex committed Apr 24, 2023
1 parent 73402b2 commit 973a24f
Show file tree
Hide file tree
Showing 19 changed files with 290 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/.phpunit.cache
/.php-cs-fixer.cache
/.phpunit.result.cache
/.phpunit.cache
/.phpunit.cache
composer.lock
Empty file modified .php-cs-fixer.php
100644 → 100755
Empty file.
Empty file modified LICENCE
100644 → 100755
Empty file.
Empty file modified phpunit.xml
100644 → 100755
Empty file.
17 changes: 17 additions & 0 deletions stubs/ChartWidget.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace {{ namespace }};

use Filament\Widgets\{{ chart }}Widget;

class {{ class }} extends {{ chart }}Widget
{
protected static ?string $heading = 'Chart';

protected function getData(): array
{
return [
//
];
}
}
13 changes: 13 additions & 0 deletions stubs/CustomResourcePage.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace {{ namespace }};

use {{ resource }};
use {{ baseResourcePage }};

class {{ resourcePageClass }} extends {{ baseResourcePageClass }}
{
protected static string $resource = {{ resourceClass }}::class;

protected static string $view = '{{ view }}';
}
12 changes: 12 additions & 0 deletions stubs/Page.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace {{ namespace }};

use Filament\Pages\Page;

class {{ class }} extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = '{{ view }}';
}
3 changes: 3 additions & 0 deletions stubs/PageView.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<x-filament::page>

</x-filament::page>
48 changes: 48 additions & 0 deletions stubs/RelationManager.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace {{ namespace }};

use Filament\Forms;
use Filament\Resources\Form;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Resources\Table;
use Filament\Tables;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class {{ managerClass }} extends RelationManager
{
protected static string $relationship = '{{ relationship }}';

protected static ?string $recordTitleAttribute = '{{ recordTitleAttribute }}';

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('{{ recordTitleAttribute }}')
->required()
->maxLength(255),
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('{{ recordTitleAttribute }}'),
])
->filters([
{{ tableFilters }}
])
->headerActions([
{{ tableHeaderActions }}
])
->actions([
{{ tableActions }}
])
->bulkActions([
{{ tableBulkActions }}
]);
}{{ eloquentQuery }}
}
53 changes: 53 additions & 0 deletions stubs/Resource.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace {{ namespace }};

use {{ resource }}\Pages;
use {{ resource }}\RelationManagers;
use App\Models\{{ model }};
use Filament\Forms;
use Filament\Resources\Form;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class {{ resourceClass }} extends Resource
{
protected static ?string $model = {{ modelClass }}::class;

protected static ?string $navigationIcon = 'heroicon-o-collection';

public static function form(Form $form): Form
{
return $form
->schema([
{{ formSchema }}
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
{{ tableColumns }}
])
->filters([
{{ tableFilters }}
])
->actions([
{{ tableActions }}
])
->bulkActions([
{{ tableBulkActions }}
]);
}
{{ relations }}
public static function getPages(): array
{
return [
{{ pages }}
];
}{{ eloquentQuery }}
}
19 changes: 19 additions & 0 deletions stubs/ResourceEditPage.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace {{ namespace }};

use {{ resource }};
use Filament\Pages\Actions;
use Filament\Resources\Pages\EditRecord;

class {{ resourcePageClass }} extends EditRecord
{
protected static string $resource = {{ resourceClass }}::class;

protected function getActions(): array
{
return [
{{ actions }}
];
}
}
19 changes: 19 additions & 0 deletions stubs/ResourceListPage.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace {{ namespace }};

use {{ resource }};
use Filament\Pages\Actions;
use Filament\Resources\Pages\ListRecords;

class {{ resourcePageClass }} extends ListRecords
{
protected static string $resource = {{ resourceClass }}::class;

protected function getActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}
19 changes: 19 additions & 0 deletions stubs/ResourceManagePage.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace {{ namespace }};

use {{ resource }};
use Filament\Pages\Actions;
use Filament\Resources\Pages\ManageRecords;

class {{ resourcePageClass }} extends ManageRecords
{
protected static string $resource = {{ resourceClass }}::class;

protected function getActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}
12 changes: 12 additions & 0 deletions stubs/ResourcePage.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace {{ namespace }};

use {{ resource }};
use Filament\Pages\Actions;
use {{ baseResourcePage }};

class {{ resourcePageClass }} extends {{ baseResourcePageClass }}
{
protected static string $resource = {{ resourceClass }}::class;
}
19 changes: 19 additions & 0 deletions stubs/ResourceViewPage.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace {{ namespace }};

use {{ resource }};
use Filament\Pages\Actions;
use Filament\Resources\Pages\ViewRecord;

class {{ resourcePageClass }} extends ViewRecord
{
protected static string $resource = {{ resourceClass }}::class;

protected function getActions(): array
{
return [
Actions\EditAction::make(),
];
}
}
16 changes: 16 additions & 0 deletions stubs/StatsOverviewWidget.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace {{ namespace }};

use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Card;

class {{ class }} extends BaseWidget
{
protected function getCards(): array
{
return [
//
];
}
}
23 changes: 23 additions & 0 deletions stubs/TableWidget.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace {{ namespace }};

use Closure;
use Filament\Tables;
use Filament\Widgets\TableWidget as BaseWidget;
use Illuminate\Database\Eloquent\Builder;

class {{ class }} extends BaseWidget
{
protected function getTableQuery(): Builder
{
// ...
}

protected function getTableColumns(): array
{
return [
// ...
];
}
}
10 changes: 10 additions & 0 deletions stubs/Widget.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace {{ namespace }};

use Filament\Widgets\Widget;

class {{ class }} extends Widget
{
protected static string $view = '{{ view }}';
}
5 changes: 5 additions & 0 deletions stubs/WidgetView.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<x-filament::widget>
<x-filament::card>
{{-- Widget content --}}
</x-filament::card>
</x-filament::widget>

0 comments on commit 973a24f

Please sign in to comment.