PHP code example of pardalsalcap / linter-redirections
1. Go to this page and download the library: Download pardalsalcap/linter-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 / linter-redirections example snippets
return [
];
use Pardalsalcap\HialoRedirections\Repositories\RedirectionRepository;
public function render($request, Throwable $e) {
switch(class_basename($e)){
case 'NotFoundHttpException':
$http_status = $e->getStatusCode();
$redirection_repository = new RedirectionRepository();
$redirection = $redirection_repository->check(request()->fullUrl());
if ($redirection) {
return redirect($redirection->fix, $redirection->http_status);
}
if ($http_status == "404")
{
$redirection_repository->logError(request()->fullUrl(), $http_status);
}
break;
}
return parent::render($request, $e);
}
namespace App\Filament\Resources;
class RedirectionResource extends \Pardalsalcap\LinterRedirections\Resources\RedirectionResource
{
// Any additional logic here
}