laravel-datatables icon indicating copy to clipboard operation
laravel-datatables copied to clipboard

Problems with quick-starter

Open robman70 opened this issue 2 years ago • 5 comments

Summary of problem or feature request

I followed the instructions here step by step (I hope I didn't skip something, but I don't think so): https://yajrabox.com/docs/laravel-datatables/master/quick-starter and I found two problems:

1 - after running this command (unfortunately I don't know yarn, so I did not understand exactly what it is for): yarn dev / watch / prod I get as response: Usage Error: Couldn't find a script named "dev"

2 - when I try to start the application, I get this error: Declaration of App \ DataTables \ UsersDataTable :: filename () must be compatible with Yajra \ DataTables \ Services \ DataTable :: filename (): string

Surely I did something wrong but I don't understand what. In particular, the second error also turns up in another test I had previously done following this tutorial: https://yajrabox.com/docs/laravel-datatables/8.0/editor-tutorial

Instead, a previous tutorial I tried works correctly (but does not include the datatables editor): https://www.positronx.io/laravel-datatables-example/#tc_10503_02

I'm trying to get a full example of the editing features... :-(

Can anyone help me?

Thank you :-)

System details

  • Operating System: Windows 10
  • PHP Version: 8.1.6
  • Laravel Version: 9.17.0
  • Laravel-Datatables Version: 10.0.7

robman70 avatar Jun 08 '22 15:06 robman70

Nobody? :-(

robman70 avatar Jun 13 '22 11:06 robman70

1 - after running this command (unfortunately I don't know yarn, so I did not understand exactly what it is for): yarn dev / watch / prod I get as response: Usage Error: Couldn't find a script named "dev

Use npm run dev or check pacakge.json for the scripts available.

2 - when I try to start the application, I get this error: Declaration of App \ DataTables \ UsersDataTable :: filename () must be compatible with Yajra \ DataTables \ Services \ DataTable :: filename (): string

On filename method, add a string return type. Might be a bug in the stub, will try to fix when I got the chance.

Lastly, newer Laravel now uses <x-app-layout> instead of @extends. Other than that, everything should be the same.

Sorry for outdated documentation.

yajra avatar Jun 14 '22 04:06 yajra

Thank you for your response.

Sorry... I'm pretty new to Laravel: what does it means "Lastly, newer Laravel now uses instead of @extends"?

I fixed the other problems but now I don't see any data in datatable. Maybe I didn't understand the purpose of this project... it's normal? The instruction "return $dataTable->render('users.index');" renders the datatable but with no data in it?

Thanks a lot, Roberto

robman70 avatar Jun 14 '22 10:06 robman70

It will render the view views/users/index.blade.php. The content on Laravel 9 is something like below:

<x-app-layout>

    {{ $dataTable->table() }}
    
    @push('scripts')
        {{ $dataTable->scripts() }}
    @endpush

</x-app-layout>

yajra avatar Jun 15 '22 03:06 yajra

I'm sorry to keep disturbing but I'm a little frustrated ...

Do I need a component named "app-layout"?

New error:

InvalidArgumentException PHP 8.1.6 9.17.0 Unable to locate a class or view for component [app-layout].

Collapse vendor frames Illuminate \ View \ Compilers \ ComponentTagCompiler: 299 componentClass Illuminate \ View \ Compilers \ ComponentTagCompiler: 211 componentString Illuminate \ View \ Compilers \ ComponentTagCompiler: 144 Illuminate\View\Compilers{closure}

robman70 avatar Jun 15 '22 07:06 robman70

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 09 '22 02:10 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Oct 17 '22 00:10 github-actions[bot]