-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
How can I customize shetabit/visitor Laravel package?
I have visited class I want to add mobile and name fields to it. How do I set it in the controller?
filling methods did not works?
class Visit extends Model
{
protected $table = 'visits';
protected $fillable = [
'method', 'request', 'url', 'referer',
'languages', 'useragent', 'headers',
'device', 'platform', 'browser', 'ip','name','mobile',
'visitor_id', 'visitor_type',
];
protected $casts = [
'request' => 'array',
'languages' => 'array',
'headers' => 'array'
];
public function visitable()
{
return $this->morphTo('visitable');
}
public function visitor()
{
return $this->morphTo('visitor');
}
}
$model = \App\Models\Visit::make();
$request = Request::instance();
$name = $request->request->get('name');
$mobile = $request->request->get('mobile');
$model->fill(['name' => $name]);
$model->fill(['mobile' => $mobile]);
var_dump($model);
$request->visitor()->visit($model);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels