public function record(): bool
    {
        if ($this->shouldRecord()) {
            $view = app(ViewContract::class);
            $view->viewable_id = $this->viewable->getKey();
            $view->viewable_type = $this->viewable->getMorphClass();
            $view->visitor = $this->resolveVisitorId();
            $view->collection = $this->collection;
            $view->viewed_at = Carbon::now();

            return $view->save();
        }

        return false;
    }
public function record(): bool
    {
        if ($this->shouldRecord()) {
            $view = app(ViewContract::class);
            $view->viewable_id = $this->viewable->getKey();
            $view->viewable_type = $this->viewable->getMorphClass();
            $view->visitor = $this->resolveVisitorId();
            $view->collection = $this->collection;
            $view->viewed_at = Carbon::now();

            return $view->save();
        }

        return false;
    }
public function record ( ) : bool { if ( $ this -> shouldRecord ( ) ) { $ view = app ( ViewContract :: class ) ; $ view -> viewable_id = $ this -> viewable -> getKey ( ) ; $ view -> viewable_type = $ this -> viewable -> getMorphClass ( ) ; $ view -> visitor = $ this -> resolveVisitorId ( ) ; $ view -> collection = $ this -> collection ; $ view -> viewed_at = Carbon :: now ( ) ; return $ view -> save ( ) ; } return false ; }
Save a new record of the made view.

@return bool
Save a new record of the made view .