Skip to content

Instantly share code, notes, and snippets.

<template>
<!-- user form -->
</template>
<script>
export default {
methods: {
saveUser: function() {
let formData = new FormData(document.getElementById(this.formId));
window.axios.post('/users', formData)
<?php
public function store() {
$this->_validate();
User::create( request()->input() );
return new JsonResponse( [ 'message' => 'success' ] );
}
protected function _validate() {
$this->validate( request(), [
'name' => 'required|unique:users',
<?php
$userWithPosts = User::with(['posts'])->paginate(10);
notifications: {
successSave: {
title: 'Success',
message: 'Proceso correcto',
type: 'success'
},
errorSave: {
title: 'Error',
message: 'Error en el proceso',
type: 'error'
import VueNotifications from 'vue-notifications';
import miniToastr from 'mini-toastr';
window.Vue.use(BlockUI);
const toastTypes = {
success: 'success',
error: 'error',
info: 'info',
warn: 'warn'
<?php
public function store()
{
$error = null;
DB::beginTransaction();
try {
Module::buildComponent("type1");
<?php
/**
* @param Company $model
*/
public function edit(Company $model) {
//TODO mostrar el formulario de edición de la compañía
}
<?php
Route::resource('/companies', 'CompanyController', ['parameters' => [
'companies' => 'model'
]]);
/**
GET|HEAD | companies | companies.index | App\Http\Controllers\CompanyController@index | web,auth |
POST | companies | companies.store | App\Http\Controllers\CompanyController@store | web,auth |
GET|HEAD | companies/create | companies.create | App\Http\Controllers\CompanyController@create | web,auth |
DELETE | companies/{model} | companies.destroy | App\Http\Controllers\CompanyController@destroy | web,auth |
@uno-de-piera
uno-de-piera / web.php
Last active September 19, 2017 11:58
<?php
Route::resource('/companies', 'CompanyController');
/**
GET|HEAD | companies | companies.index | App\Http\Controllers\CompanyController@index | web,auth |
POST | companies | companies.store | App\Http\Controllers\CompanyController@store | web,auth |
GET|HEAD | companies/create | companies.create | App\Http\Controllers\CompanyController@create | web,auth |
DELETE | companies/{company} | companies.destroy | App\Http\Controllers\CompanyController@destroy | web,auth |
GET|HEAD | companies/{company} | companies.show | App\Http\Controllers\CompanyController@show | web,auth |
PUT|PATCH | companies/{company} | companies.update | App\Http\Controllers\CompanyController@update | web,auth |
<company-list
:companies="{{ json_encode($companies) }}"
>
</company-list>