<?php

namespace App\Http\Controllers;

use App\Log;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Validator;

class LogController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
        if(!Gate::allows('日志-查询')){ return redirect(url('/'));  }
        $logs=Log::orderBy('id','desc')->paginate(55);
        return view('maintenance.log.index',['logs'=>$logs]);
    }

    /**
     * Display the specified resource.
     *
     * @param Log $log
     * @return Response
     */
    public function show(Log $log)
    {
        return view('maintenance.log.show',['log'=>$log]);
    }


    /**
     * Remove the specified resource from storage.
     *
     * @param Log $log
     * @return array|Response
     * @throws Exception
     */
    public function destroy(Log $log)
    {
//        if(!Gate::allows('物流公司-删除')){ return redirect(url('/'));  }
//        $this->log(__METHOD__,__FUNCTION__,$log->toJson(),Auth::user()['id']);
//        $re=$log->delete();
//        return ['success'=>$re];
    }
}
