You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can achieve this by using your own custom model and [eloquent models events](https://laravel.com/docs/5.6/eloquent).
Create a new model class like this (untested):
namespaceApp\Models;
classYourStatusModelextends \Spatie\ModelStatus\Status
public staticfunction boot()
{
// this function will automatically be executed by Laravel when a new `Status` is being created.static::creating(function(YourStatusModel$status) {
$status->causer_id = optional(auth()->user())->id;
});
}
Set that class in the status_model key of the model-status config file.
Create a migration that adds caused_id to the statuses table.
i want to be able to pass in the id of the auth user so that at the end of the day when am pulling the statuses attached to the model i can get the detail of that user who made comment
by the way I would like to thank the creators of this package its really nice thanks alot though its lacking this feature anyone to guide me how to achieve this
because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.
Set that class in the
status_model
key of themodel-status
config file.Create a migration that adds
caused_id
to thestatuses
table.Profit!
Originally posted by @freekmurze in #38 (comment)
The text was updated successfully, but these errors were encountered: