TypeError method_exists():
AzizAhmad147 opened this issue · 4 comments
hi dear i use your package and i had the fllowing error
Argument #1 ($object_or_class) must be of type object|string, null given http://localhost:8000/
when i use
\Shetabit\Visitor\Middlewares\LogVisits::class,
in meddleware group in kernel.php
could you give me more description of the problem? which line generates an error?
and could you fix it and send pull request
?
::method_exists
D:\xamp\htdocs\Darman\vendor\shetabit\visitor\src\Visitor.php:241
this condition work in visitor.php
if (method_exists($model, 'visitLogs')) {
$visit = $model->visitLogs()->create($data);
} else {
$visit = Visit::create($data);
}
return $visit;
}
just change in vendor\shetabit\visitor\src\Visitor.php
if (method_exists($model, 'visitLogs'))
to
if ($model!=null && method_exists($model, 'visitLogs'))
could you fix it and send pull request?