我使用一个命令将API中的产品添加到我的数据库中,使用以下代码
class UpdateCatalog extends Command {
protected $name = 'catalog:update';
protected $description = 'Command description.';
public function __construct()
{
parent::__construct();
}
public function fire()
{
我使用的是laravel审核--它显示了UUID上的一个错误--我认为,我已经从安装并配置了laravel审核,并将user_id和id更改为UUID,默认类型为bigInteger。
public function up()
{
Schema::create('audits', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('user_type')->nullable();
我希望能够设计一个数据库,其中具有以下内容;
customer
--------------
id(int) | name
Company
-------------------------
id(int) | name | location
queue
--------------------------------------------------------------------------------
id (datetime-primary but not auto-increment) | company_id | customer_id | posit
控制器功能:
public function index () {
// TESTED
// The getAllActiveSuppliers() function just return Supplier::pagniate(10)
$suppliers = $this -> model -> getAllActiveSuppliers();
return new SupplierResource($suppliers);
}
返回的Json:
{
"current_page": 1,
public function up() {
Schema::create('orders', function (Blueprint $table) {
$table->increments('id');
$table->unsignedBigInteger('seller_id');
$table->foreign('seller_id')->references('id'
我使用这个设置进行了迁移:
$table->increments('id');
$table->integer('user_id', 10)->unsigned(); // this is meant to be used as a foreign key
执行迁移后,它将返回一个错误:
[Exception]