我已经有了一个表名,table_one.现在我想再添加两列。到目前为止一切正常。但是在我的方法中,我想检查表中是否存在某列,例如dropIfExists('table').
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('table_one', function (Blueprint $table) {
$table->string('column_one')->nullable();
$table->string('column_two')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('table_one', function (Blueprint $table) {
// in here i want to check column_one and column_two exists or not
$table->dropColumn('column_one');
$table->dropColumn('column_two');
});
}
Run Code Online (Sandbox Code Playgroud) 哪一个最适合 Rest API 响应?
{
"version": "1.0.0",
"isError": false,
"statusCode": 200,
"message": "Permission Object",
"data": {
"id": 1,
"name": "user create",
"created_at": "2022-11-30T10:18:20.000000Z"
}
}
Run Code Online (Sandbox Code Playgroud)
{
"id": 1,
"name": "user create",
"created_at": "2022-11-30T10:18:20.000000Z"
}
Run Code Online (Sandbox Code Playgroud)
如果还有其他更好的方法请给我建议。