Looking to hire Laravel developers? Try LaraJobs

laravel-redirect maintained by mdooley47

Description
Extends Laravel's redirect capabilities
Last update
2024/03/23 20:55 (dev-master)
License
Links
Downloads
19
Tags

Comments
comments powered by Disqus

[!IMPORTANT] This project is old and not used anymore. Please use something like ash-jc-allen/short-url instead.

laravel-redirect

Install

You can install the package with composer:

composer require mdooley47/laravel-redirect

How To Use

The purpose of this package is to provide a default targetUrl when redirecting in Laravel, if the current target does not match the desired url.

Simply call defaultTarget($options, $default) on the Redirect Facade. $options either an array listing the robust validation options provided by mdooley47/laravel-urlvalidator or a string that will use the host validator provided by mdooley47/laravel-urlvalidator.

\Illuminate\Support\Facades\Redirect::back()
    ->defaultTarget('match.domain.tld', 'default.domain.tld');

// Returns \Illuminate\Support\Facades\Redirect::getTargetUrl()