Skip to content

Commit

Permalink
chore: run pint
Browse files Browse the repository at this point in the history
  • Loading branch information
discoverlance-com committed Feb 19, 2023
1 parent 847424d commit 6da3c83
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 32 deletions.
2 changes: 1 addition & 1 deletion config/filament-page-hints.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* Rich Text Editor used for hints toolbar buttons can be edited here.
*/
"toolbar_buttons" => [
'toolbar_buttons' => [
'blockquote',
'bold',
'bulletList',
Expand Down
7 changes: 3 additions & 4 deletions database/factories/PageHintFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

namespace Discoverlance\FilamentPageHints\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Discoverlance\FilamentPageHints\Models\PageHint;

use Illuminate\Database\Eloquent\Factories\Factory;

class PageHintFactory extends Factory
{
Expand All @@ -16,7 +15,7 @@ public function definition()
'title' => '',
'hint' => '',
'route' => '',
'url' => ''
];
'url' => '',
];
}
}
13 changes: 6 additions & 7 deletions src/Concerns/HintForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

namespace Discoverlance\FilamentPageHints\Concerns;

use Filament\Forms\Components\Card;
use Illuminate\Support\Facades\Route;
use Closure;
use Filament\Forms;
use Discoverlance\FilamentPageHints\Resources\PageHintsResource\Pages;
use Filament\Forms;
use Filament\Forms\Components\Card;
use Illuminate\Support\Facades\Route;
use Livewire\Component as Livewire;

class HintForm
{

public static function getTitleComponent(): \Filament\Forms\Components\TextInput
{
return Forms\Components\TextInput::make('title')
Expand Down Expand Up @@ -59,14 +58,14 @@ function () {

public static function new(): array
{
return array(
return [
Card::make()
->schema([
self::getTitleComponent(),
self::getRouteComponent(),
self::getUrlComponent(),
self::getHintComponent(),
])
);
]),
];
}
}
10 changes: 5 additions & 5 deletions src/FilamentPageHintsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace Discoverlance\FilamentPageHints;

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\Commands\InstallCommand;
use Filament\PluginServiceProvider;
use Discoverlance\FilamentPageHints\Commands\FilamentPageHintsCommand;
use Discoverlance\FilamentPageHints\Resources\PageHintsResource;
use Filament\Facades\Filament;
use Filament\Pages\Page;
use Filament\PluginServiceProvider;
use Illuminate\Support\Facades\Blade;
use Livewire\Livewire;
use Spatie\LaravelPackageTools\Commands\InstallCommand;
use Spatie\LaravelPackageTools\Package;

class FilamentPageHintsServiceProvider extends PluginServiceProvider
{
Expand All @@ -19,7 +19,7 @@ class FilamentPageHintsServiceProvider extends PluginServiceProvider
];

protected array $styles = [
'filament-page-hints-styles' => __DIR__ . '/../dist/filament-page-hints.css',
'filament-page-hints-styles' => __DIR__.'/../dist/filament-page-hints.css',
];

public function configurePackage(Package $package): void
Expand Down Expand Up @@ -55,7 +55,7 @@ public function boot()
);

Livewire::listen('component.hydrate.initial', function ($component, $request) {
if (!($component instanceof Page)) {
if (! ($component instanceof Page)) {
return;
}

Expand Down
13 changes: 9 additions & 4 deletions src/Http/Livewire/PageHints.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace Discoverlance\FilamentPageHints\Http\Livewire;

use Discoverlance\FilamentPageHints\Concerns\HintForm;
use Discoverlance\FilamentPageHints\Models\PageHint;
use Filament\Forms;
use Filament\Forms\ComponentContainer;
use Livewire\Component;
use Filament\Notifications\Notification;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Route;
use \Discoverlance\FilamentPageHints\Models\PageHint;
use Filament\Notifications\Notification;
use Illuminate\View\View;
use Filament\Forms;
use Livewire\Component;

/**
* @property ComponentContainer $form
Expand All @@ -20,10 +20,15 @@ class PageHints extends Component implements Forms\Contracts\HasForms
use Forms\Concerns\InteractsWithForms;

public ?Collection $pageHints;

public ?PageHint $model = null;

public ?string $title = '';

public ?string $hint = '';

public ?string $route = '';

public ?string $url = '';

public function mount(): void
Expand Down
10 changes: 6 additions & 4 deletions src/Resources/PageHintsResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

namespace Discoverlance\FilamentPageHints\Resources;

use Discoverlance\FilamentPageHints\Resources\PageHintsResource\Pages;
use Discoverlance\FilamentPageHints\Concerns\HintForm;
use Discoverlance\FilamentPageHints\Models\PageHint;
use Filament\Forms;
use Discoverlance\FilamentPageHints\Resources\PageHintsResource\Pages;
use Filament\Resources\Form;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;
use Discoverlance\FilamentPageHints\Concerns\HintForm;

class PageHintsResource extends Resource
{
protected static ?string $model = PageHint::class;

protected static ?string $navigationIcon = 'heroicon-o-information-circle';
protected static ?string $recordTitleAttribute = "title";

protected static ?string $recordTitleAttribute = 'title';

protected static function shouldRegisterNavigation(): bool
{
Expand Down Expand Up @@ -81,6 +81,7 @@ public static function getPages(): array
'edit' => Pages\EditPageHints::route('/{record}/edit'),
];
}

public static function getModelLabel(): string
{
return __('filament-page-hints::translations.resource.label.hint');
Expand All @@ -90,6 +91,7 @@ public static function getPluralModelLabel(): string
{
return __('filament-page-hints::translations.resource.label.hints');
}

protected static function getNavigationLabel(): string
{
return __('filament-page-hints::translations.nav.label');
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/PageHintsResource/Pages/CreatePageHints.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Discoverlance\FilamentPageHints\Resources\PageHintsResource\Pages;

use Discoverlance\FilamentPageHints\Resources\PageHintsResource;
use Filament\Pages\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreatePageHints extends CreateRecord
Expand All @@ -13,6 +12,7 @@ class CreatePageHints extends CreateRecord
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['url'] = route($data['route']);

return $data;
}
}
2 changes: 1 addition & 1 deletion src/Resources/PageHintsResource/Pages/EditPageHints.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ protected function getActions(): array
Actions\DeleteAction::make(),
];
}
}
}
2 changes: 1 addition & 1 deletion src/Resources/PageHintsResource/Pages/ListPageHints.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ protected function getActions(): array
Actions\CreateAction::make(),
];
}
}
}
9 changes: 5 additions & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Discoverlance\FilamentPageHints\Tests;

use Illuminate\Database\Eloquent\Factories\Factory;
use Orchestra\Testbench\TestCase as Orchestra;
use Discoverlance\FilamentPageHints\FilamentPageHintsServiceProvider;
use Discoverlance\FilamentPageHints\Http\Livewire\PageHints;
use Filament\FilamentServiceProvider;
use Illuminate\Database\Eloquent\Factories\Factory;
use Livewire\Livewire;
use Livewire\LivewireServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;

class TestCase extends Orchestra
{
Expand All @@ -17,7 +17,7 @@ protected function setUp(): void
parent::setUp();

Factory::guessFactoryNamesUsing(
fn (string $modelName) => 'Discoverlance\\FilamentPageHints\\Database\\Factories\\' . class_basename($modelName) . 'Factory'
fn (string $modelName) => 'Discoverlance\\FilamentPageHints\\Database\\Factories\\'.class_basename($modelName).'Factory'
);

// $this->registerLivewireComponents();
Expand All @@ -26,6 +26,7 @@ protected function setUp(): void
protected function registerLivewireComponents(): self
{
Livewire::component('page-hints', PageHints::class);

return $this;
}

Expand All @@ -43,7 +44,7 @@ public function getEnvironmentSetUp($app)
{
config()->set('database.default', 'testing');

$migration = include __DIR__ . '/../database/migrations/create_filament_page_hints_table.php.stub';
$migration = include __DIR__.'/../database/migrations/create_filament_page_hints_table.php.stub';
$migration->up();
}
}

0 comments on commit 6da3c83

Please sign in to comment.