我创建了一个 Laravel 项目,并添加了一些带有 Migrate 的表。它工作正常。表已经有数据。现在我需要另一个表,并尝试使用以下命令添加它:
php artisan make:migration create_books_table
Run Code Online (Sandbox Code Playgroud)
它正在工作并在 \database\migrations 中添加文件...。然后我在 up() 函数中添加了架构。但是当我运行命令时,
php artisan migrate
Run Code Online (Sandbox Code Playgroud)
它不起作用,给出错误 Base table or view already exists。
请帮忙。我对laravel很陌生。谢谢
迁移代码..
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBooksTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('books', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->text('description');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('books');
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用laravel api应用程序,我必须将base64编码的图像上传到AWS S3存储桶。
我可以直接上传图片
$this->request->imageInput->store('public');//in local server
Storage::disk('s3')->put('FILENAME', file_get_contents('imageInput'));//in S3 server
Run Code Online (Sandbox Code Playgroud)
如何将base64编码的图像上传到AWS S3存储桶,并在获得图像信息的地方获得响应?