laravel 🚀
php 🚀
angular 🚀
Redirecting back to original Angular.js destination from Laravel Auth

UPDATE

You can see in the comments some updated info.

When a user visits an Angular url (not html5) like http://foo.com/app#some/long/path

Then gets redirected to http://foo.com/auth/login because they are not logged in. It would be nice to send them right back after that.

These steps will make that possible.

Include this file in your authentication page.

#intended.js
(function(){
    'use strict';

    var intended = window.location.hash;
    (intended.length > 0) ? jQuery.cookie('intended', '/app' + intended) : jQuery.cookie('intended', '/app');

})();

Then add this library to your app jquery.cookies.js and load that, this script and of course jquery.

Finally after an successful auth add this

return Redirect::to($_COOKIE['intended']);

Laravel 4.2 = app/controllers/AuthController.php:61

Laravel 5 = app/Http/Controllers/AuthController.php:52