Skip to content

Commit

Permalink
Merge pull request #15 from ahmed-abdelnasser/master
Browse files Browse the repository at this point in the history
add except for routes to dont save reuest , dont store value of passwords without hash
  • Loading branch information
khanzadimahdi authored Aug 7, 2020
2 parents b63aa72 + 817e743 commit 94b6bd8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config/visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
*/
'default' => 'jenssegers',

//except save request or route names
'except' => ['login','register'],

/*
|--------------------------------------------------------------------------
| List of Drivers
Expand Down
11 changes: 10 additions & 1 deletion src/Visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

class Visitor implements UserAgentParser
{
/**
* except.
*
* @var array
*/
protected $except ;
/**
* Configuration.
*
Expand Down Expand Up @@ -56,7 +62,7 @@ public function __construct(Request $request, $config)
{
$this->request = $request;
$this->config = $config;

$this->except = $config['except'];
$this->via($this->config['default']);
$this->setVisitor($request->user());
}
Expand Down Expand Up @@ -228,6 +234,9 @@ public function getVisitor() : ?Model
public function visit(Model $model = null)
{
$data = $this->prepareLog();
if(in_array($this->request->path(),$this->except)){
unset($data['request']);
}

if (method_exists($model, 'visitLogs')) {
$visit = $model->visitLogs()->create($data);
Expand Down

0 comments on commit 94b6bd8

Please sign in to comment.