PHP code example of pardalsalcap / hailo-redirections

1. Go to this page and download the library: Download pardalsalcap/hailo-redirections 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/ */

    

pardalsalcap / hailo-redirections example snippets


return [
    '404' => true,
];

public function render($request, Throwable $e) {
    if ($e instanceof NotFoundHttpException) {
        $http_status = $e->getStatusCode();
        $redirection_repository = new RedirectionRepository();
        $redirection = $redirection_repository->logError(request()->fullUrl(), $http_status);
        if (!empty($redirection->fix)) {
            return redirect($redirection->fix, $redirection->http_status);
        }
    }
    return parent::render($request, $e);
}
bash
php artisan vendor:publish --tag="hailo-redirections-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="hailo-redirections-config"
bash
php artisan vendor:publish --tag="hailo-redirections-views"