Closed curtisdelicata closed 3 months ago
Here are the code search results. I'm now analyzing these search results to write the PR.
app/Filament/Pages/ApiTokensPage.php
Copy the contents of https://github.com/stephenjude/filament-jetstream/blob/main/stubs/App/Filament/Pages/API/ApiTokensPage.php into this new file in the app/Filament/Pages directory.
<?php
namespace App\Filament\Pages;
use App\Models\User;
use Filament\Pages\Page;
use Illuminate\Support\Facades\Auth;
use Livewire\Livewire;
class ApiTokensPage extends Page
{
protected static string $view = 'filament.pages.api.api-tokens';
protected static ?string $navigationIcon = 'heroicon-o-key';
protected static ?string $navigationGroup = 'Account';
protected static ?int $navigationSort = 2;
protected static string $title = 'API Tokens';
public User $user;
public function mount(): void
{
$this->user = Auth::user();
}
public function createApiToken(string $name, array $permissions): void
{
$this->user->createToken($name, $permissions);
}
public function deleteApiToken(string $name): void
{
$this->user->tokens()->where('name', $name)->first()->delete();
}
protected function getHeading(): string
{
return static::$title;
}
protected static function shouldRegisterNavigation(): bool
{
return config('filament-jetstream.show_api_token_page');
}
}
app/Filament/Pages/PersonalAccessTokensPage.php
Copy the contents of https://github.com/stephenjude/filament-jetstream/blob/main/stubs/App/Filament/Pages/Profile/PersonalAccessTokensPage.php into this new file in the app/Filament/Pages directory.
<?php
namespace App\Filament\Pages;
use App\Models\User;
use Filament\Pages\Page;
use Illuminate\Support\Facades\Auth;
use Livewire\Livewire;
class PersonalAccessTokensPage extends Page
{
protected static string $view = 'filament.pages.profile.personal-access-tokens';
protected static ?string $navigationIcon = 'heroicon-o-key';
protected static ?string $navigationGroup = 'Account';
protected static ?int $navigationSort = 3;
protected static string $title = 'Personal Access Tokens';
public User $user;
public function mount(): void
{
$this->user = Auth::user();
}
public function createApiToken(string $name): void
{
$this->user->createToken($name);
}
public function deleteApiToken(string $name): void
{
$this->user->tokens()->where('name', $name)->first()->delete();
}
protected function getHeading(): string
{
return static::$title;
}
protected static function shouldRegisterNavigation(): bool
{
return config('filament-jetstream.show_personal_access_tokens_page');
}
}
app/Filament/Pages/TwoFactorAuthenticationPage.php
Copy the contents of https://github.com/stephenjude/filament-jetstream/blob/main/stubs/App/Filament/Pages/Profile/TwoFactorAuthenticationPage.php into this new file in the app/Filament/Pages directory.
<?php
namespace App\Filament\Pages;
use App\Models\User;
use Filament\Pages\Page;
use Illuminate\Support\Facades\Auth;
use Livewire\Livewire;
class TwoFactorAuthenticationPage extends Page
{
protected static string $view = 'filament.pages.profile.two-factor-authentication';
protected static ?string $navigationIcon = 'heroicon-o-key';
protected static ?string $navigationGroup = 'Account';
protected static ?int $navigationSort = 4;
protected static string $title = 'Two Factor Authentication';
public User $user;
public function mount(): void
{
$this->user = Auth::user();
}
public function enableTwoFactorAuthentication(): void
{
$this->user->enableTwoFactorAuthentication();
}
public function disableTwoFactorAuthentication(): void
{
$this->user->disableTwoFactorAuthentication();
}
public function showRecoveryCodes(): void
{
$this->user->showRecoveryCodes();
}
public function regenerateRecoveryCodes(): void
{
$this->user->regenerateRecoveryCodes();
}
protected function getHeading(): string
{
return static::$title;
}
protected static function shouldRegisterNavigation(): bool
{
return config('filament-jetstream.show_two_factor_authentication_page');
}
}
app/Filament/Pages/UpdatePasswordPage.php
Copy the contents of https://github.com/stephenjude/filament-jetstream/blob/main/stubs/App/Filament/Pages/Profile/UpdatePasswordPage.php into this new file in the app/Filament/Pages directory.
<?php
namespace App\Filament\Pages;
use Filament\Forms\Components\TextInput;
use Filament\Pages\Page;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules\Password;
class UpdatePasswordPage extends Page
{
protected static string $view = 'filament.pages.profile.update-password';
protected static ?string $navigationIcon = 'heroicon-o-lock-closed';
protected static ?string $navigationGroup = 'Account';
protected static ?int $navigationSort = 1;
protected static string $title = 'Update Password';
public $current_password;
public $new_password;
public $new_password_confirmation;
public function mount(): void
{
$this->form->fill();
}
protected function getFormSchema(): array
{
return [
TextInput::make('current_password')
->label('Current Password')
->password()
->rules(['required', 'current_password'])
->required(),
TextInput::make('new_password')
->label('New Password')
->password()
->rules(['required', Password::defaults(), 'confirmed'])
->required(),
TextInput::make('new_password_confirmation')
->label('Confirm Password')
->password()
->rules(['required'])
->required(),
];
}
public function submit(): void
{
$this->form->getState();
$state = array_filter([
'password' => Hash::make($this->new_password),
]);
$user = Auth::user();
$user->forceFill($state)->save();
session()->flash('status', 'Your password has been updated.');
}
protected function getHeading(): string
{
return static::$title;
}
protected static function shouldRegisterNavigation(): bool
{
return config('filament-jetstream.show_update_password_page');
}
}
app/Filament/Pages/UpdateProfileInformationPage.php
Copy the contents of https://github.com/stephenjude/filament-jetstream/blob/main/stubs/App/Filament/Pages/Profile/UpdateProfileInformationPage.php into this new file in the app/Filament/Pages directory.
<?php
namespace App\Filament\Pages;
use Filament\Forms\Components\TextInput;
use Filament\Pages\Page;
use Illuminate\Support\Facades\Auth;
class UpdateProfileInformationPage extends Page
{
protected static string $view = 'filament.pages.profile.update-profile-information';
protected static ?string $navigationIcon = 'heroicon-o-user';
protected static ?string $navigationGroup = 'Account';
protected static ?int $navigationSort = 0;
protected static string $title = 'Profile';
public $name;
public $email;
public function mount(): void
{
$this->form->fill([
'name' => Auth::user()->name,
'email' => Auth::user()->email,
]);
}
protected function getFormSchema(): array
{
return [
TextInput::make('name')
->label('Name')
->required(),
TextInput::make('email')
->label('Email Address')
->required(),
];
}
public function submit(): void
{
$this->form->getState();
$state = array_filter([
'name' => $this->name,
'email' => $this->email,
]);
$user = Auth::user();
$user->forceFill($state)->save();
session()->flash('status', 'Your profile has been updated.');
}
protected function getHeading(): string
{
return static::$title;
}
protected static function shouldRegisterNavigation(): bool
{
return config('filament-jetstream.show_update_profile_information_page');
}
}
app/Filament/Pages/FanChartPage.php
---
+++
@@ -7,26 +7,23 @@
class FanChartPage extends Page
{
- protected static string $view = 'livewire.fan-chart';
-
- protected static ?string $resource = null;
-
- protected static ?string $title = ' Fan Charts';
+ protected static string $view = 'filament.pages.fan-chart';
protected static ?string $navigationIcon = 'heroicon-o-chart-pie';
- public function getTitle(): string
- {
- return static::$title;
- }
+ protected static ?string $navigationGroup = 'Reports';
- public static function getNavigationIcon(): string
- {
- return static::$navigationIcon;
- }
+ protected static ?int $navigationSort = 0;
+
+ protected static string $title = 'Fan Chart';
public function mount(): void
{
Livewire::mount(\App\Http\Livewire\FanChart::class);
}
+
+ protected function getHeading(): string
+ {
+ return static::$title;
+ }
}
Your changes have been successfully made to the branch sweep/copy_files_from
. I have validated these changes using a syntax checker and a linter.
[!TIP] To recreate the pull request, edit the issue title or description.
This is an automated message generated by Sweep AI.
Details
Copy files from https://github.com/stephenjude/filament-jetstream/tree/main/stubs%2FApp%2FFilament%2FPages into app/Filament/Pages