-
-
Save omitobi/4f30bd5bd8734d987b7f61a1f877f79e to your computer and use it in GitHub Desktop.
Laravel redirect without return statment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//..... | |
if(!function_exists('freeRedirect')){ | |
function freeRedirect($to = '/'){ | |
throw new \Illuminate\Http\Exception\HttpResponseException(redirect($to)); | |
} | |
} | |
//............. | |
//usage | |
class AbcController extends Controller{ | |
public function aMethod(){ | |
freeRedirect('/to/another/route'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment