LaraCURDJS
JavaScript Helper library for laravel CRUD functions
Installation
- Download zip file and unzip it
- place the
laraCRUD.js
file inside you acceset folder. - create new object from
CRUD
class which is in thelaraCRUD.js
. - Call the methods
initCRUDFunctions()
to initiate curd function orinitDataTables()
to initiate datatables.
Usage
-
create a object from the
CRUD
class
example -crud = new CRUD()
-
provide the object with data to initiate crud function to the method.
example -
const crudInit = { url : url, modal : '#formModal', refreshPage : false, form: 'formData', //should pass the id with out # submitButton: '#btnSubmit', }
-
call the
initCRUDFunctions(crudInit)
by passing thecrudInit
-
LaraCURD prodives methods like
crud.onclickAdd()
,crud.onClickEdit(id, btn)
,crud.onClickDelete(id, btn)
which can be called in buttons'onclick
.
the form should be in a modal
- datatables can be initiate by calling
initDataTables()
method and passing the option object.
Extenral Libraries used
axios
jquery
Notify.js
Datatables