Пример #1
0
    }
});
Route::post("/ajax", function () {
    if (User::Auth()) {
        switch (Input::get('get')) {
            case 'categorias':
                Categoria::Ajax(Input::get('func'));
                break;
            case 'productos':
                Producto::Ajax(Input::get('func'));
                break;
            case 'pedidos':
                Pedido::Ajax(Input::get('func'));
                break;
            case 'historial':
                Historial::Ajax(Input::get('func'));
                break;
            default:
                # code...
                break;
        }
    }
});
Route::post("/auth", function () {
    switch (Input::get('get')) {
        case 'login':
            $credentials = array("email" => e(Input::get("username")), "password" => e(Input::get("password")));
            if (Auth::attempt($credentials, true, true)) {
                echo "true";
            } else {
                echo "false";