use it to set a custom route to get data from.
in the route controller method you can just return this helper function and pass your model to it dataTableOf(User::class)
.
$datatable->setGetRoute('/custom-route');
use it to set a route to send form store data to it. the first parameter is for the route and the second for the route method, by default its POST
.
$datatable->setStoreRoute('/store-route');
use it to set a route to send form update data to it.
the first parameter is for the route , and the second for the route method, by default it's PATCH
.
route parameters must be written between two columns || and these parameters will be replaced with the value from the row we are modifying
Also with the request you will get a request key called findBy
whose value in this case will be id
and you can change the findBy
request key name with this method setRequestFindByKeyName("newFindByKey")
.
$datatable->setUpdateRoute(route('update-route', '|id|'));
use it to set a route to send form delete data to it.
the first parameter is for the route , and the second for the route method, by default it's DELETE
.
route parameters must be written between two columns || and these parameters will be replaced with the value from the row we are deleting
you will also get the request key findBy
with the request as in the above example.
$datatable->setDeleteRoute(route('delete-route', '|id|'));