This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import VueNotifications from 'vue-notifications'; | |
import miniToastr from 'mini-toastr'; | |
window.Vue.use(BlockUI); | |
const toastTypes = { | |
success: 'success', | |
error: 'error', | |
info: 'info', | |
warn: 'warn' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
notifications: { | |
successSave: { | |
title: 'Success', | |
message: 'Proceso correcto', | |
type: 'success' | |
}, | |
errorSave: { | |
title: 'Error', | |
message: 'Error en el proceso', | |
type: 'error' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$userWithPosts = User::with(['posts'])->paginate(10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<!-- user form --> | |
</template> | |
<script> | |
export default { | |
methods: { | |
saveUser: function() { | |
let formData = new FormData(document.getElementById(this.formId)); | |
window.axios.post('/users', formData) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function update(User $user) | |
{ | |
if(request('email') !== $user->email) { | |
$user->notify(new NotificationClass); | |
} | |
$user->fill(request()->input())->save(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected static function boot() { | |
parent::boot(); | |
self::updating(function($user) { | |
if($user->isDirty('email')) { //si ha cambiado el correo | |
$user->notify( | |
new EmailChanged | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function update(User $user) | |
{ | |
$user->fill(request()->input())->save(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::group(['prefix' => 'admin', function() { | |
Route::resource('users', 'UserController'); | |
Route::fallback('AdminController@notFound'); | |
}]); | |
Route::resource('posts', 'PostController'); | |
Route::fallback('BaseController@notFound'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Encryption = use('Encryption'); | |
class AuthController { | |
//.... | |
async revokeUserToken ({auth, response}) { | |
const user = await auth.getUser(); | |
const token = auth.getAuthHeader(); | |
await user |