Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route [filament.admin.resources.users.edit] not defined. #10

Open
gosheto opened this issue Oct 12, 2023 · 10 comments
Open

Route [filament.admin.resources.users.edit] not defined. #10

gosheto opened this issue Oct 12, 2023 · 10 comments

Comments

@gosheto
Copy link

gosheto commented Oct 12, 2023

After click on admin panel link authentication-logs get:

Symfony \Component \Routing \Exception\RouteNotFoundException
Route [filament.admin.resources.users.edit] not defined.

$response = $kernel->handle(
$request = Request::capture()
)->send();

Tapp\FilamentAuthenticationLog\Resources\AuthenticationLogResource: 83
Tapp\FilamentAuthenticationLog\Resources{closure}

Tapp\FilamentAuthenticationLog\Resources\AuthenticationLogResource 83 line:

return new HtmlString('<a href="'.route('filament.'.Filament::getCurrentPanel()->getId().'.resources.'.Str::plural((Str::lower(class_basename($record->authenticatable::class)))).'.edit', ['record' => $record->authenticatable_id]).'" class="inline-flex items-center justify-center hover:underline focus:outline-none focus:underline filament-tables-link text-primary-600 hover:text-primary-500 text-sm font-medium filament-tables-link-action">'.class_basename($record->authenticatable::class).'</a>');

@swilla
Copy link
Member

swilla commented Oct 13, 2023

Can you send the versions of the following:

  • Laravel
  • Filament
  • PHP
  • rappasoft/laravel-authentication-log

@gosheto
Copy link
Author

gosheto commented Oct 13, 2023

  • Laravel Framework 10.28.0
  • Filament 3.0.73
  • PHP 8.2.8
  • rappasoft/laravel-authentication-log (latest yesterday install)

@gosheto
Copy link
Author

gosheto commented Oct 13, 2023

After setup Customizing the authentication features all work and routes are defined, but in clean Filament install get error Route [filament.admin.resources.users.edit] not defined.

@rmirandadev
Copy link

Any solution? I have the same problem?
Route [filament.admin.resources.users.edit] not defined.

@gosheto
Copy link
Author

gosheto commented Oct 17, 2023

Enable authentication features for a panel in the configuration file.
Follow : Authorizing access to the panel
After this create :

app/Fillament/Resources/UserResource/Auth/Pages/CreateUser.php

`<?php

namespace App\Filament\Resources\UserResource\Pages;

use App\Filament\Resources\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreateUser extends CreateRecord
{
protected static string $resource = UserResource::class;
}`

app/Fillament/Resources/UserResource/Auth/Pages/EditUser.php

`<?php

namespace App\Filament\Resources\UserResource\Pages;

use App\Filament\Resources\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

class EditUser extends EditRecord
{
protected static string $resource = UserResource::class;

protected function getHeaderActions(): array
{
    return [
        Actions\DeleteAction::make(),
    ];
}

}`

@akunbeben
Copy link

return new HtmlString('<a href="'.route('filament.'.Filament::getCurrentPanel()->getId().'.resources.'.Str::plural((Str::lower(class_basename($record->authenticatable::class)))).'.edit', ['record' => $record->authenticatable_id]).'" class="inline-flex items-center justify-center hover:underline focus:outline-none focus:underline filament-tables-link text-primary-600 hover:text-primary-500 text-sm font-medium filament-tables-link-action">'.class_basename($record->authenticatable::class).'</a>');

IMO, this line isn't necessary. I don't have the [filament.{panel}.resources.users.edit] route, others too.

@bamod33
Copy link

bamod33 commented Jan 25, 2024

Same problem here:

Route [filament.admin.resources.admins.edit] not defined.

In both, in Authentication Logs section and relation manager.

@abbasmashaddy72
Copy link
Contributor

abbasmashaddy72 commented Mar 10, 2024

You Need to have Admin Resources Created
@bamod33
User Resources Created @gosheto

artisan route:list

GET|HEAD   admin/users .................................................... filament.admin.resources.users.index › App\Filament\Admin\Resources\UserResource\Pages\ListUsers
GET|HEAD   admin/users/create ........................................... filament.admin.resources.users.create › App\Filament\Admin\Resources\UserResource\Pages\CreateUser
GET|HEAD   admin/users/{record} ............................................. filament.admin.resources.users.view › App\Filament\Admin\Resources\UserResource\Pages\ViewUser
GET|HEAD   admin/users/{record}/edit ........................................ filament.admin.resources.users.edit › App\Filament\Admin\Resources\UserResource\Pages\EditUser

if you are still facing the same issue, send the route:list

Just to make sure, are you using multiple panels?

@valpuia604
Copy link

If you user --simple flag while generating UserResource then this problem come, you have to generate without --simple flag to make this work for now

@xalabama
Copy link

There is an configuration inside the filament-authentication-log.php:

'resources' => [
        'AutenticationLogResource' => \Tapp\FilamentAuthenticationLog\Resources\AuthenticationLogResource::class,
    ],

You can create a custom resource that extends that resource, copy the table method from there and modify the line that was commented from @akunbeben by change the route or remove the anchor. After this you can change the configuration to your custom AuthenticationLogResource.

This will solve your problems for now. Further i think it will be a good idea to add some configuration for this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants