Blog posts

Laravel Redirect::to() vs Redirect::away()

For external redirection The use case here is to redirect the user to another domain. I haven’t come across Redirect::away() before, even though it’s been added in Laravel 4.0.8. Redirect::to() Redirect::away() Difference Redirect::to() does additional URL checks and generations. Those additional steps are done in Illuminate\Routing\UrlGenerator and do the following, if the passed URL is not a fully valid URL (even with protocol): Determines if URL is secure rawurlencode() the URL trim() URL

4 Very Useful Chrome Dev Tool Commands

$_ — last output maybe you don’t want to store results in a variable for quick calculations and just want to chain those computations. $0 — currently inspected element useful if you want to output or alter the selected element. angular.element($0).scope() — get AngularJS’s scope combined with $(0) this makes a great use to inspect a specific element and then check what it’s scope looks like.

Laravel's URL::to() vs URL::asset()

Short answer: No, not really. You want to have the following code: <script src="js/bootstrap.js"></script> Now you can achieve this using blade syntax: // using URL::to() <script src="{{ URL::to('js/bootstrap.js') }}"></script> // using URL::asset() <script src="{{ URL::asset('js/bootstrap.js') }}"></script> URL::to() The method is implemented like this: URL::asset() The method is implemented like this: Difference Both methods get the job done. URL::to() additionally encodes the segments of the passed url with rawurlencode URL::asset() removes index.

Design a beautiful REST API

Every dev at some point has made decisions how his backend API should look like. If you’re coming from the web, then mostly for ajax calls. But what if that API should also address calls from other sources and clients. To fill that gap i was watching an informative talk by Les Hazlewood about beautiful RESTful. I’ll cut this in several sections. This is merely an overview, the full coverage you can get from the youtube talk or the slides.