PHP code example of webudvikleren / laravel-utm-manager

1. Go to this page and download the library: Download webudvikleren/laravel-utm-manager 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/ */

    

webudvikleren / laravel-utm-manager example snippets

bash 
php artisan vendor:publish --tag=config --provider="Webudvikleren\UtmManager\UtmManagerServiceProvider"
bash
// app/Http/Kernel.php
protected $middleware = [
    // ...
    \Webudvikleren\UtmManager\Http\Middleware\CaptureUtmParameters::class,
];
bash
Route::middleware(['utm.capture'])->group(function () {
    Route::get('/register', [RegisterController::class, 'show']);
});
bash
class UtmVisit extends Model
{
    protected $table = 'utm_visits'; // or load from config('utm.table')

    protected $fillable = [
        'utm_source',
        'utm_medium',
        'utm_campaign',
        'utm_term',
        'utm_content',
    ];

    public function user()
    {
        return $this->belongsTo(User::class);
    }
}
bash
php artisan utm:make-migration
php artisan migrate
bash
php artisan utm:publish-model