hxnnxs
Black screen in production + canAccessPanel not working
Hello everyone! I encountered a very strange bug in production.
When trying to log in to the panel via an authorized email, I get a black screen and 2 errors in the console related to livewire:
1) The script from "https://example.com/livewire/livewire.min.js?id=38dc8241" was loaded, although its MIME type ("text/html") is not valid for JavaScript.
2) Uncaught SyntaxError: expected expression, got '<'
The strangest thing is that I received these errors when I had @livewireStyles and @livewireScripts in the head and body of the site.
(I have the 'inject_assets' => true option enabled in the config).
The problem is also that anyone can log in via example.com/admin, although User.php has a normally implemented canAccessPanel method.
Code:
User.php:
use Filament\Models\Contracts\FilamentUser;
use Filament\Models\Contracts\HasName;
use Filament\Panel;
...
class User extends Authenticatable implements FilamentUser, HasName
{
use HasFactory, Notifiable, SoftDeletes;
protected $fillable = [
'id',
'bio',
'nickname',
'avatar',
'email',
'password',
'provider',
...
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
];
public function getFilamentName(): string
{
return $this->nickname ?? 'admin';
}
public function canAccessPanel(Panel $panel): bool
{
return $this->email === '[email protected]';
}
...
AdminPanelProvider:
return $panel
->default()
->favicon(asset('images/logo/favicon.png'))
->id('admin')
->path('admin')
->brandLogo(asset('images/logo/favicon.png'))
->brandLogoHeight('3rem')
->login()
}
...
P.S. I can't insert the whole code because of the limitation, but I can show everything else that is needed without any problems❤️
13 replies
Add button in custom register page
Hello everyone how can I add a button on a custom registration page?
I tried using : use Filament\Forms\Components\Actions\Action; but I get the error: App\Filament\Pages\Auth\Register::getBackToDashboardComponent(): Return value must be of type Filament\Forms\Components\Component, Filament\Forms\Components\Actions\Action returned
6 replies
Do I need to specify the creator of the plugin
Hello everyone, I am doing my mini public project on github using element php, in the README I indicated that I am working with these technologies. But I also use breezy and other filament libraries. Do I need to specify all libraries that have an MIT license, or is specifying only the filament sufficient?
4 replies
SQLSTATE[HY000]: General error: 1364 Field 'tokenable_type' doesn't have a default value
Hello everyone I ran into a problem in the Api-service plugin again. This time the error is :
Although the documentation says that everything should be connected automatically, but I still have errors (I assume because of multi-tenancy)
The plugin Model code and other necessary codes are provided below. Token.php (its plugin model) : api-service.php: Comapny.php:
7 replies
SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value
Hello everyone I ran into a problem during the implementation of Multi-tenancy, I tried to do everything according to the documentation, but apparently I made a mistake somewhere. RegisterCompany.php :
Company model :
User model :
User model :
11 replies