Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Laravel News:
Laravel Model Caching
Jan 12, 2018 @ 09:16:25

On the Laravel News site they've posted a tutorial showing you how to use the caching functionality for models based on the framework's Eloquent ORM layer. This caching makes for fewer queries to the database and can improve the overall performance of the application.

You’ve probably cached some model data in the controller before, but I am going to show you a Laravel model caching technique that’s a little more granular using Active Record models. This is a technique I originally learned about on RailsCasts.

Using a unique cache key on the model, you can cache properties and associations on your models that are automatically updated (and the cache invalidated) when the model (or associated model) is updated. A side benefit is that accessing the cached data is more portable than caching data in the controller, because it’s on the model instead of within a single controller method.

They start with an example of it in action, getting the count of comments on a news article based on a relationship. It then shows the use of the touch method to change the model's updated_at timestamp to the current time allowing you to more correctly detect when changes occur. It also includes a more automatic way of performing the same operation using the $touches class property on the model and the cacheKey method to create a unique key name for use in the caching system to reference the model contents.

tagged: model caching laravel tutorial touch updatedat cachekey unique

Link: https://laravel-news.com/laravel-model-caching

NetTuts.com:
Programming With Yii2: Timestamp Behavior
May 22, 2015 @ 09:47:33

NetTuts.com has posted the next part of their "Programming with Yii2" tutorial series today. This new tutorial in the series focuses on the use of the timestamp behavior to assign the current date to an object (like for create or update dates).

In this tutorial, we'll explore Timestamp Behaviors, which reduce the amount of code you need to write with each new model for the common operation of creating timestamps for inserts and updates. We'll also dive into the Yii2 source code, examining how a behavior is implemented.

He starts with a brief look at what behaviors are (a reminder for those that may have already read about the sluggable and blameable behaviors). He then gets into the Timestamp behavior specifically and how to apply it to the sample project's "Status" instances. He shows the updates needed for the behavior configuration and rules. He also looks inside the component at the code that makes it up and the "touch" method it provides.

tagged: tutorial timestamp behavior yii2 framework series touch

Link: http://code.tutsplus.com/tutorials/programming-with-yii2-timestamp-behavior--cms-23329

php|architect:
Free iPod Touch with Purchase of PHP Training
Sep 21, 2007 @ 08:42:00

Marco Tabini has posted a reminder about a promotion they (php|architect) are offering - a free iPod Touch when you purchase a training course.

n case you haven't yet seen it, our PHP Training iPod Promo is back for the third year in a row. This is one of our most popular promotions—possibly because it's simple and evil at the same time. I mean, how often do you get a brand-new (almost not even released yet) iPod Touch when you buy a training course?

This year the promotion is a little bit different because you'll receive two iPod Touch (16G) players (three credits required for two iPods). This promo applies to training purchased between September 18 and November 30th, 2007. To check out the great range of training opportunities php|architect offers, check out their training pages.

tagged: training phparchitect ipod touch free training phparchitect ipod touch free

Link:

php|architect:
Free iPod Touch with Purchase of PHP Training
Sep 21, 2007 @ 08:42:00

Marco Tabini has posted a reminder about a promotion they (php|architect) are offering - a free iPod Touch when you purchase a training course.

n case you haven't yet seen it, our PHP Training iPod Promo is back for the third year in a row. This is one of our most popular promotions—possibly because it's simple and evil at the same time. I mean, how often do you get a brand-new (almost not even released yet) iPod Touch when you buy a training course?

This year the promotion is a little bit different because you'll receive two iPod Touch (16G) players (three credits required for two iPods). This promo applies to training purchased between September 18 and November 30th, 2007. To check out the great range of training opportunities php|architect offers, check out their training pages.

tagged: training phparchitect ipod touch free training phparchitect ipod touch free

Link: