Skip to content

Commit

Permalink
Merge pull request #36 from wcadena/ActualizacionLaravel5.7
Browse files Browse the repository at this point in the history
Actualizacion laravel5.7
  • Loading branch information
wcadena authored Nov 29, 2018
2 parents 32a11ca + efc28a2 commit 53b818c
Show file tree
Hide file tree
Showing 26 changed files with 1,871 additions and 2,172 deletions.
3 changes: 2 additions & 1 deletion .env.dusk.local
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ APP_NAME=Inventario
APP_ENV=local
APP_KEY=base64:=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://inventario3.ecuatask.dev
APP_TITLE_PAGE="Inventario de equipos y recursos"

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
Expand Down
3 changes: 2 additions & 1 deletion .env.dusk.testing
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ APP_NAME=Inventario
APP_ENV=local
APP_KEY=base64:=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://inventario3.ecuatask.dev
APP_TITLE_PAGE="Inventario de equipos y recursos"

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
Expand Down
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ APP_NAME=Inventario
APP_ENV=local
APP_KEY=base64:=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://inventario3.ecuatask.dev
APP_TITLE_PAGE="Inventario de equipos y recursos"

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Exceptions;

use App\Traits\ApiResponser;
use Barryvdh\Cors\CorsService;
use Asm89\Stack\CorsService;
use Exception;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
Expand Down
22 changes: 22 additions & 0 deletions app/Exports/Equipos2Export.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Exports;

use App\Equipos;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Session;
use Maatwebsite\Excel\Concerns\FromView;

class Equipos2Export implements FromView
{
/**
* @return View
*/
public function view(): View
{
$equipos = Equipos::get();
return view('directory.reporte.repo1excel', [
'equipos' => $equipos
]);
}
}
22 changes: 22 additions & 0 deletions app/Exports/EquiposExport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Exports;

use App\Equipos;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Session;
use Maatwebsite\Excel\Concerns\FromView;

class EquiposExport implements FromView
{
/**
* @return View
*/
public function view(): View
{
$equipos = Equipos::where('estacione_id', Session::get('flash_estacione_id'))->get();
return view('directory.reporte.repo1excel', [
'equipos' => $equipos
]);
}
}
10 changes: 9 additions & 1 deletion app/Http/Controllers/EquiposController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Response;
use Intervention\Image\ImageManagerStatic as Image;
use League\Flysystem\Exception;
Expand Down Expand Up @@ -360,11 +362,17 @@ public function reasignarindexecho(Request $request)
'equipoidfull' => 'required',
'custodio_id' => 'required',
]);
$CUSTODIO_BODEGA = Configuracion::Config('CUSTODIO_BODEGA');
if(is_null(Custodios::find($CUSTODIO_BODEGA))){
$message = Lang::get('message.notifica_custodio_bodega_error');
/* This works and the form is filled with the correct data after it redirects me back */
return Redirect::back()->withErrors(array('CUSTODIO_BODEGA' => $message))->withSettings($request->all());
}
$equipos = $request->input('equipoidfull');
$nuevo_custodio = $request->input('custodio_id');
$obj_custodio = Custodios::findOrFail($nuevo_custodio);
$nombre_responsable2 = $obj_custodio->nombre_responsable;
$CUSTODIO_BODEGA = Configuracion::Config('CUSTODIO_BODEGA');


try {
DB::beginTransaction();
Expand Down
21 changes: 5 additions & 16 deletions app/Http/Controllers/ReporteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace App\Http\Controllers;

use App\Equipos;
use App\Exports\Equipos2Export;
use App\Exports\EquiposExport;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Facades\Excel;
Expand Down Expand Up @@ -44,28 +46,15 @@ public function estaciones($estacione_id)
public function excelEstaciones($estacione_id)
{

//return view('directory.reporte.repo1excel', compact('equipos'));
Session::flash('flash_estacione_id', $estacione_id);

Excel::create('Reporte_por_estaciones', function ($excel) {
$excel->sheet('Maquinas', function ($sheet) {
$equipos = Equipos::where('estacione_id', Session::get('flash_estacione_id'))->get();
$sheet->loadView('directory.reporte.repo1excel', compact('equipos'));
});
})->download('xls');
Session::flash('flash_estacione_id', $estacione_id);
return Excel::download(new EquiposExport(), 'EquiposExport_data.xlsx');
}

public function excel()
{

//return view('directory.reporte.repo1excel', compact('equipos'));

Excel::create('Reporte_Total', function ($excel) {
$excel->sheet('Maquinas', function ($sheet) {
$equipos = Equipos::get();
$sheet->loadView('directory.reporte.repo1excel', compact('equipos'));
});
})->download('xls');
return Excel::download(new Equipos2Export(), 'EquiposExport_total.xlsx');
}

/**
Expand Down
18 changes: 17 additions & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Kernel extends HttpKernel
* @var array
*/
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
Expand All @@ -77,4 +77,20 @@ class Kernel extends HttpKernel
'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class,
];

/**
* The priority-sorted list of middleware.
*
* This forces non-global middleware to always be in the given order.
*
* @var array
*/
protected $middlewarePriority = [
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\Authenticate::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Auth\Middleware\Authorize::class,
];
}
21 changes: 21 additions & 0 deletions app/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;

class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
8 changes: 1 addition & 7 deletions app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,5 @@ class TrustProxies extends Middleware
*
* @var array
*/
protected $headers = [
Request::HEADER_FORWARDED => 'FORWARDED',
Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
];
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
7 changes: 7 additions & 0 deletions app/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

class VerifyCsrfToken extends BaseVerifier
{
/**
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
*
* @var bool
*/
protected $addHttpCookie = true;

/**
* The URIs that should be excluded from CSRF verification.
*
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
dirname(__DIR__)
);
$app->bind('path.public', function () {
return base_path().'/html';
Expand Down
Loading

0 comments on commit 53b818c

Please sign in to comment.