PHP code example of lidai / laravel-redirects

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

    

lidai / laravel-redirects example snippets


/**
 * The application's route middleware groups.
 *
 * @var array
 */
protected $middlewareGroups = [
    'web' => [
        ...
        \Lidai\Redirects\Middleware\RedirectRequests::class,

app('redirect.model')->create([
    'old_url' => '/your-old-url',
    'new_url' => '/your-new-url',
    'status' => 301
]);

php artisan vendor:publish --provider="Lidai\Redirects\ServiceProvider" --tag="config"

php artisan vendor:publish --provider="Lidai\Redirects\ServiceProvider" --tag="migrations"

php artisan migrate