/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(LocalRequest $request)
 {
     $almacen = Local::create($request->all());
     $almacen->type = 'almacen';
     $almacen->save();
     $auditoria = new Auditoria();
     $auditoria->content = 'Ha creado un nuevo Almacen: ID: ' . $almacen->id . ' - Nombre: ' . $almacen->nombre;
     $auditoria->user_id = \Auth::user()->id;
     $auditoria->save();
     //$auditoria ->  user() -> associate($user)
     Flash::success('Almacen creado exitosamente');
     return redirect()->route('admin.almacenes.index');
 }
Пример #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(LocalRequest $request)
 {
     $taller = Local::create($request->all());
     $taller->type = 'taller';
     $taller->save();
     $auditoria = new Auditoria();
     $auditoria->content = 'Ha creado un nuevo Taller: ID: ' . $taller->id . ' - Nombre: ' . $taller->nombre;
     $auditoria->user_id = \Auth::user()->id;
     $auditoria->save();
     //$auditoria ->  user() -> associate($user)
     Flash::success('Taller creado exitosamente');
     return redirect()->route('admin.talleres.index');
     //dd(\Auth::user()->id);
 }
Пример #3
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
use App\Local;
Route::get('/', function () {
    return view('welcome');
});
Route::get('/locais/gerar', function () {
    for ($i = 0; $i < 100; $i++) {
        Local::create(['id' => 0, 'codigo_local' => rand(1, 999999), 'pais' => str_random(10), 'estado' => str_random(10), 'cidade' => str_random(10)]);
    }
});
Route::get('/locais/listar', function () {
    $locais = Local::all();
    foreach ($locais as $local) {
        echo $local->codigo_local . '-' . $local->pais;
        echo '<br/>';
    }
});