public function logs(Request $request, DataTables $dataTables)
    {
        if ($request->input('l')) {
            LaravelLogViewer::setFile(base64_decode($request->input('l')));
        }

        if ($request->input('dl')) {
            return response()->download(LaravelLogViewer::pathToLogFile(base64_decode($request->input('dl'))));
        } elseif ($request->has('del')) {
            File::delete(LaravelLogViewer::pathToLogFile(base64_decode($request->input('del'))));

            return redirect()->to($request->url());
        }

        $logs = LaravelLogViewer::all();

        if ($request->wantsJson()) {
            return $dataTables->collection(collect($logs))
                              ->editColumn('stack', '{!! nl2br($stack) !!}')
                              ->editColumn('level', function ($log) {
                                  $content = html()->tag('span', '', [
                                      'class' => "glyphicon glyphicon-{$log['level_img']}-sign",
                                  ]);

                                  $content .= '&nbsp;' . $log['level'];

                                  return html()->tag('span', $content, ['class' => "text-{$log['level_class']}"]);
                              })
                              ->addColumn('content', function ($log) {
                                  $html = '';
                                  if ($log['stack']) {
                                      $html = '<a class="pull-right expand btn btn-default btn-xs"><span class="glyphicon glyphicon-search"></span></a>';
                                  }

                                  $html .= $log['text'];

                                  if (isset($log['in_file'])) {
                                      $html .= '<br>' . $log['in_file'];
                                  }

                                  return $html;
                              })
                              ->rawColumns(['content'])
                              ->toJson();
        }

        return view('administrator.utilities.log', [
            'logs'         => $logs,
            'files'        => LaravelLogViewer::getFiles(true),
            'current_file' => LaravelLogViewer::getFileName(),
        ]);
    }
public function logs(Request $request, DataTables $dataTables)
    {
        if ($request->input('l')) {
            LaravelLogViewer::setFile(base64_decode($request->input('l')));
        }

        if ($request->input('dl')) {
            return response()->download(LaravelLogViewer::pathToLogFile(base64_decode($request->input('dl'))));
        } elseif ($request->has('del')) {
            File::delete(LaravelLogViewer::pathToLogFile(base64_decode($request->input('del'))));

            return redirect()->to($request->url());
        }

        $logs = LaravelLogViewer::all();

        if ($request->wantsJson()) {
            return $dataTables->collection(collect($logs))
                              ->editColumn('stack', '{!! nl2br($stack) !!}')
                              ->editColumn('level', function ($log) {
                                  $content = html()->tag('span', '', [
                                      'class' => "glyphicon glyphicon-{$log['level_img']}-sign",
                                  ]);

                                  $content .= '&nbsp;' . $log['level'];

                                  return html()->tag('span', $content, ['class' => "text-{$log['level_class']}"]);
                              })
                              ->addColumn('content', function ($log) {
                                  $html = '';
                                  if ($log['stack']) {
                                      $html = '<a class="pull-right expand btn btn-default btn-xs"><span class="glyphicon glyphicon-search"></span></a>';
                                  }

                                  $html .= $log['text'];

                                  if (isset($log['in_file'])) {
                                      $html .= '<br>' . $log['in_file'];
                                  }

                                  return $html;
                              })
                              ->rawColumns(['content'])
                              ->toJson();
        }

        return view('administrator.utilities.log', [
            'logs'         => $logs,
            'files'        => LaravelLogViewer::getFiles(true),
            'current_file' => LaravelLogViewer::getFileName(),
        ]);
    }
public function logs ( Request $ request , DataTables $ dataTables ) { if ( $ request -> input ( 'l' ) ) { LaravelLogViewer :: setFile ( base64_decode ( $ request -> input ( 'l' ) ) ) ; } if ( $ request -> input ( 'dl' ) ) { return response ( ) -> download ( LaravelLogViewer :: pathToLogFile ( base64_decode ( $ request -> input ( 'dl' ) ) ) ) ; } elseif ( $ request -> has ( 'del' ) ) { File :: delete ( LaravelLogViewer :: pathToLogFile ( base64_decode ( $ request -> input ( 'del' ) ) ) ) ; return redirect ( ) -> to ( $ request -> url ( ) ) ; } $ logs = LaravelLogViewer :: all ( ) ; if ( $ request -> wantsJson ( ) ) { return $ dataTables -> collection ( collect ( $ logs ) ) -> editColumn ( 'stack' , '{!! nl2br($stack) !!}' ) -> editColumn ( 'level' , function ( $ log ) { $ content = html ( ) -> tag ( 'span' , '' , [ 'class' => "glyphicon glyphicon-{$log['level_img']}-sign" , ] ) ; $ content .= '&nbsp;' . $ log [ 'level' ] ; return html ( ) -> tag ( 'span' , $ content , [ 'class' => "text-{$log['level_class']}" ] ) ; } ) -> addColumn ( 'content' , function ( $ log ) { $ html = '' ; if ( $ log [ 'stack' ] ) { $ html = '<a class="pull-right expand btn btn-default btn-xs"><span class="glyphicon glyphicon-search"></span></a>' ; } $ html .= $ log [ 'text' ] ; if ( isset ( $ log [ 'in_file' ] ) ) { $ html .= '<br>' . $ log [ 'in_file' ] ; } return $ html ; } ) -> rawColumns ( [ 'content' ] ) -> toJson ( ) ; } return view ( 'administrator.utilities.log' , [ 'logs' => $ logs , 'files' => LaravelLogViewer :: getFiles ( true ) , 'current_file' => LaravelLogViewer :: getFileName ( ) , ] ) ; }
Log viewer.

@param \Illuminate\Http\Request     $request
@param \Yajra\DataTables\DataTables $dataTables
@return \Illuminate\Http\JsonResponse
@throws \Exception
Log viewer .