Datatables Editor and Laravel without yajra
Datatables Editor and Laravel without yajra
volnistii11
Posts: 49Questions: 16Answers: 0
in General
Please tell me how to use the datatable and editor correctly in laravel without yajra?
I tried using Yajra, I didn't really like it. Before that, in native php, I used datatables and everything was fine.
Answers
You would just install the Editor PHP libraries as they are normally, without using any Laravel functionality. They are effectively just installed alongside Laravel and they can exist independently.
Allan
Can you please tell me how I can correctly format the server script from your example into a method of my controller?
example of your script
My controller,method getAll()
Move line 22-52 from your first block of code into your
getAll()
method in the controller. I haven't used Laravel all that much myself, but it responds with JSON, so that should do the trick. You might need to make the$db
global variable available - or otherwise create a newDatabase()
class based on a Laravel PDO connection.Allan
I tried.
my routing
controller method
And got errors like this
That suggests to me that
$db
isnull
. Did yourequire
theDataTables.php
file? It is what creates the$db
variable in our examples. As I say though, you might need to modify that to usenew \DataTables\Database(...)
if you need to use a Laravel PDO object.Allan