filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
17.65k stars 2.76k forks source link

[2.x] Problem loading `UserResource` #761

Closed webparadoxer closed 2 years ago

webparadoxer commented 2 years ago

Package

filament/filament

Package Version

2.0

Laravel Version

8.75.0

Livewire Version

2.8.1

PHP Version

8.0.11

Bug description

After fresh instal and creating first UserResource

<?php

namespace App\Filament\Resources;

use App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource\RelationManagers;
use App\Models\User;
use Filament\Forms;
use Filament\Resources\Form;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;

class UserResource extends Resource
{
    protected static ?string $model = User::class;

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

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Forms\Components\TextInput::make('name')->required(),
                Forms\Components\TextInput::make('email')->email()->required(),

            ]);
    }

    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                Tables\Columns\TextColumn::make('id')->sortable()->searchable(),
                Tables\Columns\TextColumn::make('name')->sortable()->searchable(),
                Tables\Columns\TextColumn::make('email')->sortable()->searchable(),

            ])
            ->filters([
                //
            ]);
    }

    public static function getRelations(): array
    {
        return [
            //
        ];
    }

    public static function getPages(): array
    {
        return [
            'index' => Pages\ListUsers::route('/'),
            'create' => Pages\CreateUser::route('/create'),
            'edit' => Pages\EditUser::route('/{record}/edit'),
        ];
    }
}

Steps to reproduce

No response

Relevant log output

Uncaught (in promise) SyntaxError: Unexpected token a in JSON at position 0     at JSON.parse (<anonymous>)     at livewire.js?id=ece4c4ab4b746f6f1739:13
webparadoxer commented 2 years ago

Hmm, and after installing debugbar in console

Uncaught ReferenceError: ar is not defined at javascript?v=1634813851:1 (anonymous) @ javascript?v=1634813851:1 users:44 Uncaught ReferenceError: jQuery is not defined at users:44 (anonymous) @ users:44 users:1235 Uncaught TypeError: Cannot read properties of undefined (reading 'DebugBar') at users:1235

danharrin commented 2 years ago

Can I see your composer.json?

Also, are there any errors in the console about not being able to load scripts?