Giter VIP home page Giter VIP logo

lumen-api-demo's Issues

关于usage步骤 配置各种key的一些讨论

➜  lumen-api-demo git:(master) ✗ php artisan key:generate
Application key [eFoEZeANciqkaM8YdoTeKXN9dKRUoXsN] set successfully.
➜  lumen-api-demo git:(master) ✗ php artisan jwt:generate


[Symfony\Component\Console\Exception\CommandNotFoundException]
  Command "jwt:generate" is not defined.
Did you mean one of these?
  key:generate
  jwt:secret


➜  lumen-api-demo git:(master) ✗ php artisan key:generate
Application key [olwMeLDwDuQ9eKKoIZ7RWZmXm2WMDPuo] set successfully.

以上生成的key需要手动拷贝到 .env里面,好像laravel5.1是自动跟新该文件的。另外要使以上命令能运行需要按照以下的步骤设置一下。
Lumen Micro Framework => php artisan key:generate

请教一个问题

jwt身份验证,框架是否还要加一些别的加密方式,如果私有key之类的。不知这个框架是否支持ssl.每次都在这边打扰你,怪不好意思的。是否可加我qq:121419067

wrong assignment in base repo

file: app/Repositories/Eloquent/BaseRepository.php

public function where(array $data)
{
    $this->model = $this->model->where($data);
    return $this;
}

$model->where() will call the magic method __call, and get the new instance of '\Illuminate\Database\Eloquent\Builder' rather than the '\Illuminate\Database\Eloquent\Model'

一处错误

app/Http/Controllers/Api/V1/UserController.php:6
更改为
use ApiDemo\Repositories\Contracts\UserRepositoryInterface;

接口是使用policy ,报错 “This action is unauthorized”

//policy中修改资源的权限 UserOriResPolicy
public function update(User $user,UserOriFiles $userOriFiles){
return $user->uid === $userOriFiles->author_id;
}

// controller中的方法
public function update($id){
//侧路模式的权限判断

	$userOriFile = UserOriFiles::find($id);
	$isok = $this->authorize('update',$userOriFile);

最后接口一直报错
“This action is unauthorized”,
google 上有这个问题,但没有回答,你有在项目中用到Policy 吗?

https://www.laracasts.com/discuss/channels/laravel/laravel-54-policies-not-working-with-jwt

请教个问题

有个问题想请教下,关于 Token 的刷新机制的。

通过什么方式来刷新 Token 呢?是在请求返回 Token 失效之后去请求刷新一下 Token?然后再请求上次的数据吗?还是过期之前就去刷新?

请教一个问题

// jwt 需要实现的方法
public function getJWTIdentifier()
{
return $this->getKey();
}

// jwt 需要实现的方法
public function getJWTCustomClaims()
{
    return [];
}

想问下这两个函数主要要实现什么?是否能具体说明?非常感谢。

请问Transformer里面的includeUser怎样使用啊?

我现在是这样子手动加载使用。我看见你的demo里面没有其他关于includeUser调用的代码。自己尝试了很久也没发现可以自动加载的。

return $this->response()
            ->paginator($articles, (new ArticleTransformer)->setDefaultIncludes(['user']));

微信验证token cors报错

lumen.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Symfony\Component\HttpFoundation\Response::header()' in /data/wwwroot/yi.dizeng.net/app/Http/Middleware/Cors.php:43

不知道哪的问题,有空了研究

数据库无法连接?

In Connection.php line 664:

could not find driver (SQL: select * from information_schema.tables where table_schema = chat and table
_name = migrations)

In Connector.php line 67:

could not find driver

Using Session inside Lumen

First thing, thank you to create this very useful demo API in Lumen.

I have a question related to work around using PHP session in Lumen 5.2 and 5.3. I know it's removed in these version. Just wonder if you have any advice if I want to use Session.

Again thank you very much

关于http status 200

今天碰到一个问题,java开发的安卓,只能访问http status200的状态,其他400,500都不解析。晕死。这框架本身很多就是抛出异常,都是400,500的。不知如何解决这种问题。研究了一天,没有头绪。不知能否给出一个解决方案,千分感谢

meta

meta中的links格式问题,如果links为空,返回一个空数组,反之返回一个对象,这种数据不一致的情况算bug吗?具体源码出在这里\vendor\league\fractal\src\Serializer\ArraySerializer.php, $pagination['links'] = [];

    if ($currentPage > 1) {
        $pagination['links']['previous'] = $paginator->getUrl($currentPage - 1);
    }

    if ($currentPage < $lastPage) {
        $pagination['links']['next'] = $paginator->getUrl($currentPage + 1);
    }

这里如果 $pagination['links'] 没有值的情况下,直接就输入出了初始化的这个[]

请教一个在lumen+dingo+jwt+laravel_wechat的环境下的问题

在验证微信服务器的时候,提示:
ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Symfony\Component\HttpFoundation\Response::header()
我知道可能是dingo response的问题,我想自定义一个controller不使用dingo的response或者是不使用dingo的middleware,但是我是菜鸟,花了很长时间还是没有弄好,
请您看下是怎么回事

put接收不到数据

我在做update操作的时候接受不都put/patch过来的数据,get,post,delete都行。不知道是不是dingo哪里没有配置好。lumen 5.3

Auth driver [jwt] for guard [api] is not defined.

app.php中把这个注释打开后报错,不太清楚这个逻辑,请问能讲下吗。
app('Dingo\Api\Auth\Auth')->extend('jwt', function ($app) {
return new Dingo\Api\Auth\Provider\JWT($app['Tymon\JWTAuth\JWTAuth']);
});

请教一个关于dingo api的问题

您好,请问如何能统一dingo api返回的异常处理结构,现在一旦报异常,就只有messaage和status_code2个字段;比如我用laravel5.4的用户授权中,采用Policy方式,在路由中加can:update,**,来验证授权,一旦授权不允许,会返回
{ "message": "This action is unauthorized.", "status_code": 500 }

我想自定义这个结构。

need authentication的情况下,发送带有token的header,会返回The Response content must be a string or object implementing __toString(), \"boolean\" given.

在本地调试的,不知道怎么回事,重新下载最新版,全新安装的也是这种情况 php version 5.6.27 + apache 我测试了https://lumen.lyyw.info/api/user 没有返回这个错误,请帮助看下,多谢
流程:
1.通过https://lumen.lyyw.info/api/users,post用户,得到token
2.通过https://lumen.lyyw.info/api/user header里面Authorization为:Bearer {token}
流程应该是没有问题的,用的postman调试的

cors功能貌似有问题

  1. clone当前节点上的代码,composer install(删除掉vendor先)
  2. 跨域的时候cors不生效,但是放到$app->middleware后生效。
$app->middleware([
    // 根据 accept-language 设置语言
    'locale' => App\Http\Middleware\ChangeLocale::class,
    'cors' => palanik\lumen\Middleware\LumenCors::class,
]);

$app->routeMiddleware([
    //'cors' => palanik\lumen\Middleware\LumenCors::class,
    'auth' => App\Http\Middleware\Authenticate::class,
    'serializer' => \Liyu\Dingo\SerializerSwitch::class,
]);
  1. 另外这个第三放组件不管啥options请求都劫持并返回肯定是不好的。
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next) {

        if ($request->isMethod('OPTIONS')) {
            $response = new Response("", 200);
        }
        else {
            $response = $next($request);
        }

有个地方有点问题

PostController中的

public function show($id)
    {
       // $post = $this->post->findOrFail($id);  <-写错了
        $post = Post::findOrFail($id); 
        return $this->response->item($post, new PostTransformer());
    }

请问能使用模糊查询吗

请问能使用模糊查询吗,where(array $data)->paginate(); 这样只能正确匹配,我想进行模糊匹配的,像like %abd%

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.