chinkiver

1580 经验值

Laravel5.5 如何发送HTTP请求?继续使用 GuzzleHttp 吗?

例如,我需要get钉钉的url来获取它的token。

你的Route是Route::post吗?另外,你有没有正确引入 use Illuminate\Http\Request; ?

Hi~jellybool, Nice to meet you.

当我续费时,并没有发现我的签到日期能够兑换成优惠金额,请帮我确认下。

Thanks.

如何用 Post 方法,携带 Token 调用 jwt.auth 中间件下的路由?

我的tags表

    public function up()
    {
        Schema::create('tags', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name', 50);
            $table->timestamps();
        });
    }

我的article_tag表

    public function up()
    {
        Schema::create('article_tag', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('article_id')->unsigned()->index();
            $table->foreign('article_id')->references('id')->on('articles')->onDelete('cascade');
            $table->integer('tag_id')->unsigned()->index();
            $table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
            $table->timestamps();
        });
    }

我的articles表

    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title', 100);
            $table->text('content');
            $table->timestamps();
        });
    }

执行php artisan migrate

Migration table created successfully.



  [Illuminate\Database\QueryException]

  SQLSTATE[HY000]: General error: 1005 Can't create table `laraveltest`.`#sql-111c_37` (errno: 150 "Foreign key cons
train
  t is incorrectly formed") (SQL: alter table `article_tag` add constraint article_tag_article_id_foreign foreign ke
y (`a
  rticle_id`) references `articles` (`id`) on delete cascade)






  [PDOException]

  SQLSTATE[HY000]: General error: 1005 Can't create table `laraveltest`.`#sql-111c_37` (errno: 150 "Foreign key cons
train
  t is incorrectly formed")



我的tags表

    public function up()
    {
        Schema::create('tags', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name', 50);
            $table->timestamps();
        });
    }

我的article_tag表

    public function up()
    {
        Schema::create('article_tag', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('article_id')->unsigned()->index();
            $table->foreign('article_id')->references('id')->on('articles')->onDelete('cascade');
            $table->integer('tag_id')->unsigned()->index();
            $table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
            $table->timestamps();
        });
    }

我的articles表

    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title', 100);
            $table->text('content');
            $table->timestamps();
        });
    }

执行php artisan migrate

Migration table created successfully.



  [Illuminate\Database\QueryException]

  SQLSTATE[HY000]: General error: 1005 Can't create table `laraveltest`.`#sql-111c_37` (errno: 150 "Foreign key cons
train
  t is incorrectly formed") (SQL: alter table `article_tag` add constraint article_tag_article_id_foreign foreign ke
y (`a
  rticle_id`) references `articles` (`id`) on delete cascade)






  [PDOException]

  SQLSTATE[HY000]: General error: 1005 Can't create table `laraveltest`.`#sql-111c_37` (errno: 150 "Foreign key cons
train
  t is incorrectly formed")



migrate 创建 $table->foreign('article_id')->references('id')->on('articles')->onDelete('cascade');
难道不需要单独创建一个叫“articles”的表吗?

一个Class只能有一个construct方法