1. Go to this page and download the library: Download coderflexx/laravisit library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
coderflexx / laravisit example snippets
return [
/*
|--------------------------------------------------------------------------
| User Namespace
|--------------------------------------------------------------------------
|
| This value informs Laravisit which namespace you will be
| selecting to get the user model instance
| If this value equals to null, "\Coderflex\Laravisit\Models\User" will be used
| by default.
|
*/
'user_namespace' => "\Coderflex\Laravisit\Models\User",
];
namespace App\Models\Post;
use Coderflex\Laravisit\Concerns\CanVisit;
use Coderflex\Laravisit\Concerns\HasVisits;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Post extends Model implements CanVisit
{
...
use HasFactory;
use HasVisits;
...
}
$post->visit();
bash
# linux
php artisan vendor:publish --provider="Coderflex\\Laravisit\\LaravisitServiceProvider"
# windows
php artisan vendor:publish --provider="Coderflex\Laravisit\LaravisitServiceProvider"
bash
php artisan migrate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.