/** * Run the migrations. * * @return void */ public function up() { $file_insert = new TheFile(); $file_insert->name = 'FAC3363.201114'; $file_insert->date_generated = '2014-11-20'; $file_insert->user_id = 2; $file_insert->upload = 0; $file_insert->type = 'facturacion'; $file_insert->save(); }
/** * Controlador del listado de cobranzas. **/ public function listado_cobranzas() { $all_files_facturas = TheFile::where('type', '=', 'cobranzas')->orderBy('id', 'DESC')->paginate(10); foreach ($all_files_facturas as $k => $file) { $all_files_facturas[$k]->nombre_usuario = User::find($file->user_id)->email; } return View::make('template_tisa/listado_cobranzas', array('files' => $all_files_facturas)); }
<?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 Closure to execute when that URI is requested. | */ Route::get('/cargo_archivo', function () { $usuario = User::find(2); $archivo = new TheFile(); $archivo->name = 'file_name_archivo.txt'; $archivo->user_id = $usuario->id; $archivo->type = 'cobranzas'; // $archivo->file()->associate($usuario); $archivo->save(); }); Route::get('/', function () { // return View::make('hello'); if (Auth::check()) { return View::make('template_tisa/homepage'); } else { return View::make('template_tisa/login'); } }); Route::get('login', array('as' => 'login_get', function () { if (Auth::check()) {