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

Matt Stauffer:
Implicit route model binding in Laravel 5.2
Dec 18, 2015 @ 15:34:53

Matt Stauffer has continued his series looking at the new features of Laravel v5.2. In this new article he talks about the addition of implicit route model binding. This is a bit more fancy term for the ability to link models to routes and tell Laravel they're related.

If you've never used it, Laravel's route model binding has been around for a while, but Laravel 5.2 is about to make it even easier. [...] In your route service provider, just teach the router: $router->model('shoe', 'AppShoe'); That means, "any time I have a route parameter named shoe, it's an ID representing an instance of AppShoe". [...] In Laravel 5.2, it's even easier to use route model binding. Just typehint a parameter in the route Closure (or your controller method) and name the parameter the same thing as the route parameter.

He includes code examples of the "old way" to do it with model functionality inside the route and the "new way" of linking the model to the route. This allows you to auto-magically have a valid model instance once the route is called. He also shares some of the little known features of this model binding including using closures in bind() calls and changing the "route key" away from the "id" column.

tagged: model route binding laravel feature implicit feature v52

Link: https://mattstauffer.co/blog/implicit-model-binding-in-laravel-5-2

Chris Jones:
Using PHP and Oracle Database 12c Implicit Result Sets
Jul 26, 2013 @ 14:12:40

Chris Jones has a new post to his site showing you how to use Oracle 12c's implicit result sets in your code. Note: this functionality is still in development, so the naming/exact functionality might change.

The new Oracle Database 12c "Implicit Result Sets" (IRS) feature allows query results to be returned from a stored PL/SQL procedure (or a PL/SQL anonymous block) without requiring special PHP code. Support for IRS is available in PHP OCI8 2.0.0-devel extension when it is compiled and used with Oracle Database 12c. (OCI8 2.0 can be compiled and used with other versions of Oracle Database but the available feature set is reduced).

He shows a normal fetch loop that calls the oci_* functions and grabs each row with a oci_fetch_row call. He updates this to use an anonymous PL/SQL block (a string) instead that allows for more flexibility. He includes examples that fetch from one table, multiple tables and returns multiple result sets (that can be fetched one at a time) from the same single call.

tagged: implicit result set oracle 12c tutorial multiple single sql plsql

Link: https://blogs.oracle.com/opal/entry/using_php_oci8_2_0


Trending Topics: