-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I audit delete options #136
Comments
Hi @cesarcruzc , I would like to better understand your case. Can you provide an example of what you are doing. |
Hi @anteriovieira. I'm using Laravel 5.2 and working with repository pattern. This is an example of my Models: ` use Illuminate\Database\Eloquent\Model;
} |
I am testing this package https://github.com/spatie/laravel-activitylog and I have the same issue. am I doing something wrong? |
As you are deleting the model? Because have some queries that laravel does not run events. |
This should work. $AccidentCase = AccidentCase::find(1);
$AccidentCase ->delete(); |
My Repository:
|
This is the same case reported in issues 139. |
The solution is the following: class AccidentCaseRepository extends BaseRepository
{
protected $accidentCase;
public function __construct(AccidentCase $accidentCase)
{
$this->accidentCase = $accidentCase;
}
public function deleteDataByWorker($workerId)
{
$accidentCase = $this->accidentCase->find($workerId);
return $accidentCase->delete();
}
} |
ops! |
class AccidentCaseRepository extends BaseRepository
{
protected $accidentCase;
public function __construct(AccidentCase $accidentCase)
{
$this->accidentCase = $accidentCase;
}
public function deleteDataByWorker($workerId)
{
$accidentCase = $this->accidentCase
->where('bdc_datos_trabajador_id', $workerId)
->firstOrFail();
return $accidentCase->delete();
}
} |
@anteriovieira Thank you so much! |
When I delete a record dont log in the table audits
The text was updated successfully, but these errors were encountered: