cacheglobal function (gasp!) in 5.3, written by yours truly.
resources/assets/jsfolder to check it out. It's important to note, however, that this is all entirely optional. If you prefer Ember or Backbone, delete the contents of your main
app.jsentry point, and you're good to go! It's only a suggestion.
forelseBlade directives, you'll now have a new
$loopobject available to each iteration. This will provide useful information about the loop, including the current index, if it's the first or last item, if there are remaining iterations for the loop, and more.
toggle()method on all
belongsToManyrelationships. This solves the issue of needing to delete a pivot table record if it exists, or adding it if it doesn't. As an example, consider needing to toggle a user's "like" status for a post.
UploadedFileinstance offers a new
store()method for rapidly saving files - even all the way to S3 (as we'll do in this video).
Laravel Scout is a driver-based solution for performing advanced, full text search on your Eloquent models. Out of the box, it comes with support for Algolia, which offers a fantastic service. In this episode, we'll learn how to set everything up, and send a table full of records to Algolia. For the more curious among you, we'll also, toward the end of the video, dig into the guts of Scout to figure out how everything is put together behind the scenes.
searchable()method. While we're reviewing this, we'll also take some time to review custom rankings with Algolia.
In Laravel 5.3, a number of facades provide a static
fake method that can be called to replace the underlying class with a minimal fake version, for the purposes of testing. A fake is a type of test double, where you create a light, barebones implementation of a particular API or interface in order to satisfy or assist a given test.
Consider a scenario where the code you're testing fires an event. Well, it's possible that you don't want the associated event listeners to be triggered, as part of that test. Instead, we can use a double: replace the underlying event dispatcher with a fake version. Now, we can assert that the necessary event was triggered, without worrying about any of the side effects from firing an actual real event. It sounds complicated, but I assure you that it's all very simple.
true, but excluding the current user's email address. As you may know, traditionally, we must provide a comma separated list within a string for all of these parameters. It's pretty rough! But not anymore. Now, in Laravel 5.3, you can use the useful
Ruleclass to fluently build up these constraints.