Skip to content

Instantly share code, notes, and snippets.

@mihailsitnic
Created August 28, 2018 10:33
Show Gist options
  • Save mihailsitnic/839193f0a45a4ad029129003c2eb4ed3 to your computer and use it in GitHub Desktop.
Save mihailsitnic/839193f0a45a4ad029129003c2eb4ed3 to your computer and use it in GitHub Desktop.
// В деректории resources/assets/js/admin/Api я создал файл Services.js
import '../core';
import Router from '../../common/Router';
import makeForm from './shared/jsonFromJqueryForm';
export default class Services {
static index() {
return $.get(Router.name('service.index'));
}
static store(id, data) {
return $.get(Router.name('service.store', id), makeForm(data));
}
static show() {
return $.post(Router.name('service.show'));
}
static update(id, data) {
return $.put(Router.name('service.update', id), makeForm(data));
}
static destroy(id, data) {
return $.delete(Router.name('service.destroy', id), makeForm(data));
}
}
// В файле resources/assets/js/admin/pages/services.js я импортирую его
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment