Laravel 5 Sample Application Code Now Available

  • January 03, 2017

Welcome to the incredibly popular Easy Laravel 5 companion blog. To celebrate the new edition's release (updated for Laravel 5.5!) use the discount code easteregg to receive 20% off the book or book/video package! » Buy the book

The most effective way one can learn a new programming language or framework is by repeatedly building things and learning from mistakes made along the way. However, while this approach is effective it isn't efficient, because learning in this fashion can often take months. Fortunately, one can reduce some of this time requirement by experimenting with an existing application that has been built by a fellow developer who has already gone through the trouble of taking the long way around the mountain.

For this reason I try to base my books around a companion project, and make the code available to readers. This was no different with Easy Laravel 5, in which I base much of the material around a fictional social event application named HackerPair. Today I'm pleased to announce all of the HackerPair code is available on GitHub at https://github.com/wjgilmore/hackerpair.

The HackerPair site embodies many features Laravel developers would likely want to integrate into their own web applications, including user authentication, complex models and database relationships, e-mail delivery, sophisticated views and layouts, and Vue.js-based interface enhancement. I'll highlight a few other key features here:

  • Multiple Blade Templates: HackerPair uses multiple layouts to display different pages in a variety of fashions.
  • Comprehensive Database Seeding Examples: Many beginning developers tend to skip over the generation of real-world data for the development environment. HackerPair includes extensive data generation scripts (known as seeds) for users, events, categories, and locations.
  • Form Integration and Validation: HackerPair uses the powerful LaravelCollective/HTML package for forms generation, and relies on formalized Laravel procedures for input validation including use of the native Laravel validators and form requests.
  • Extensive Model Relationships: HackerPair offers numerous examples of model relationships by including features such as event creation (events are owned by users), event favorites (users can favorite many events), event locations (events belong to states, states have many events), and so on.
  • User Authentication and Profile Management: Laravel offers great off-the-shelf support for user registration and login, however developers will quickly outgrow the defaults. HackerPair extends the registration form to include several additional fields, extensively modifies the default registration and login view formatting, and adds account profile management.
  • Social Login: In addition to standard user registration and authentication, users can instead opt to login using a third-party service such as GitHub and Twitter.
  • Nested Routes: As you application grows in complexity, you'll want to make sure the routes are defined using the most intuitive approach. This often means taking advantage of nested routes. The HackerPair source code and book will show you how to integrate these often confusing routes into your own application.
  • Route Model Binding: The app takes advantage of route model binding whenever practical, eliminating a great deal of otherwise required boilerplate code.
  • Vue.js Features: Vue.js is Laravel's de facto JavaScript library. HackerPair includes a number of cool Vue.js features, including AJAX-driven event favoriting, Google Maps integration, an event attendance widget, and notifications.
  • Bootstrap 4 Integration: Although Bootstrap 4 is still in beta at the time of this writing, I wanted to give it a spin and am glad I did. Although I will make clear I'm not a CSS nor design guru, and you'll find some of my styling to be repulsive. At any rate, in the book you'll also learn how to integrate Bootstrap 3, Bootstrap 4, and the new Tailwind CSS frameworks.
  • Extensive Automated Testing: One of my favorite Laravel features is the practically push button automated test integration. The HackerPair project includes extensive testing of numerous aspects of the code, including unit tests, model tests, and integration tests using Laravel Dusk.
  • A REST API (forthcoming): We want to give developers the chance to build their own cool HackerPair applications, and so have exposed a REST API which allows information about events to be retrieved for display in a variety of formats.
  • Middleware: The native Authenticate middleware is used in the application to determine if a user is logged in and therefore allowed to perform certain tasks and see restricted content.

Best of all, all interested Laravel developers are provided with free access to the HackerPair GitHub repository. Head on over to GitHub to download the latest release.

Questions about the code or book? E-mail me anytime at wj@wjgilmore.com. Follow me on Twitter at @wjgilmore.com for an ongoing stream of information about my books, Laravel, PHP, and other fun stuff.