问题
I am trying to use oauth2-server-laravel with laravel-mongodb. After I generate migration using this command php artisan oauth2-server:migrations
I tried to use php artisan migrate
. But I got this error.
[ErrorException]
Missing argument 1 for Illuminate\Database\Schema\Blueprint::primary(),
called in
/home/opu/www/cwc_penguins/app/database/migrations/2015_01_19_203037
_create_oauth_scopes_table.php on line 17 and defined
2015_01_19_203037_create_oauth_scopes_table.php
Migration code here
<?php
use Illuminate\Database\Schema\Blueprint;
use LucaDegasperi\OAuth2Server\Support\Migration;
class CreateOauthScopesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema()->create('oauth_scopes', function (Blueprint $table) {
$table->string('id', 40)->primary();
$table->string('description');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$this->schema()->drop('oauth_scopes');
}
}
回答1:
Remove this:
->primary()
And it should work.
回答2:
Or you can change it to ->primary('id') (or whatever the field name is). That's what I did.
来源:https://stackoverflow.com/questions/28039418/configuring-oauth2-server-laravel-with-laravel-mongodb