Exemplo n.º 1
0
 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     $code = Phpcode::orderBy('created_at', 'desc')->get();
     return view('admin', ['admin' => $code]);
 }
Exemplo n.º 2
0
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => 'web'], function () {
    if (isset($_COOKIE['laravel_session'])) {
        setcookie("laravel_session", "", time() - 3600);
    }
    Route::auth();
    Route::get('/login', function () {
        Auth::logout();
        return view('auth/login');
    });
    Route::post('/home', function (Request $request) {
        $validator = Validator::make($request->all(), ['code' => 'required']);
        if ($validator->fails()) {
            return redirect('/home')->withInput()->withErrors($validator);
        }
        $code = new Phpcode();
        $code->code = $request->code;
        $code->email = Auth::user()->email;
        $code->save();
        return view('home', ['test' => $request->code]);
    });
    Route::get('/home', 'HomeController@index');
    Route::get('/admin', function () {
        $codes = Phpcode::orderBy('created_at', 'desc')->get();
        return view('codes', ['codes' => $codes]);
    });
});