Моя проблема на данный момент в том, что я хочу сохранить некоторые значения в базе данных, но они не сохраняются, и я не получаю сообщение об ошибке.
Оба, либо $product-save();
, либо $product-update(array(...))
не работают, и я не могу сказать, почему .. Моя модель ASIN выглядит нормально и заполнена правильными заполняемыми атрибутами ...
Ребята, вы знаете, почему это не работает?
My Laravel Версия: Laravel Framework 5.5.36
Пока это мой класс:
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\ASIN;
class CheckPrice extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'post:CheckPrice';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle() {
$product = ASIN::find(1410);
$product->price = "HELLO";
$product->amountSaved = "HELLO";
$product->percentageSaved = "HELLO";
$product->url = "HELLO";
$product->imgUrl = "HELLO";
$product->save();
//$product->update(array("price" => "HELLO", "amountSaved" => "HELLO", "percentageSaved" => "HELLO", "url" => "HELLO", "imgUrl" => "HELLO"));
$this->printProduct(ASIN::find(1410));
}
Моя модель ASIN до сих пор:
приложение namespace;
use Illuminate\Database\Eloquent\Model;
class ASIN extends Model
{
protected $connection = 'facebook_amazon';
public $table = "ASINS";
protected $fillable = [
'ASIN',
'price',
'amountSaved',
'percentageSaved',
'category',
'url',
'imgUrl',
'showApp'
];
}
С уважением и спасибо!