I'm using this package in my Lumen 8.0 project, it's all working fine up until the point i'm trying to update or delete a record in my database using the model's instance. When I call $model->delete() it does return true but the record in the database never get's deleted. Same goes for $model->update($array), the record does not get updated but the properties in the model itself do. Now I have this workaround to delete (or update) a record Model::where('id', $model->id)->delete() which does work, but it would be nice to just be able to use the model's instance..
To give an example of how I build my models with this package:
<?php
namespace App\Models;
use Sofa\Eloquence\Eloquence;
use Sofa\Eloquence\Mappable;
class Status extends Model
{
use Eloquence, Mappable;
protected $maps = [
'opened' => 'status_opened',
'processed' => 'status_processed',
];
protected $casts = [
'opened' => 'boolean',
'processed' => 'boolean',
];
protected $fillable = [
'opened',
'processed',
];
public function __construct()
{
parent::__construct();
$this->appends = array_keys($this->maps);
$this->hidden = array_values($this->maps);
}
}
I'm using this package in my Lumen 8.0 project, it's all working fine up until the point i'm trying to update or delete a record in my database using the model's instance. When I call
$model->delete()
it does return true but the record in the database never get's deleted. Same goes for$model->update($array)
, the record does not get updated but the properties in the model itself do. Now I have this workaround to delete (or update) a recordModel::where('id', $model->id)->delete()
which does work, but it would be nice to just be able to use the model's instance..To give an example of how I build my models with this package: