Hi,
$asset->save();
Ok but that is $asset, it could be anything... and what you are trying to save exactly?
When I am changing the table name and connection name in the Models save() method gives error
My Models code
class AssetModel extends SnipeModel
{
use SoftDeletes;
protected $connection = 'mysql1';
protected $presenter = 'App\Presenters\AssetModelPresenter';
use Requestable, Presentable;
protected $dates = ['deleted_at'];
protected $table = 'inventory_models';
protected $hidden = ['user_id','deleted_at'];
public function assets()
{
return $this->hasMany('\App\Models\Asset', 'model_id');
}
}
class Asset extends Depreciable
{
protected $presenter = 'App\Presenters\AssetPresenter';
use Loggable, Requestable, Presentable, SoftDeletes, ValidatingTrait, UniqueUndeletedTrait, UniqueSerialTrait;
protected $connection = 'mysql1';
const LOCATION = 'location';
const ASSET = 'asset';
const USER = 'drupaluser';
const ACCEPTANCE_PENDING = 'pending';
/**
* Set static properties to determine which checkout/checkin handlers we should use
*/
public static $checkoutClass = CheckoutAssetNotification::class;
public static $checkinClass = CheckinAssetNotification::class;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'inventory_assets';
public function model()
{
return $this->('\App\Models\AssetModel', 'model_id')->withTrashed();
}
}
$asset->save() gives error
Please or to participate in this conversation.