16
Php

Extend Laravel Eloquent Collection Object

According to Laravel, all multi-result sets returned by Eloquent, either via the get method or a relationship, will return a collection object. This object implements the IteratorAggregate PHP interface so it can be iterated over like an array. However, this object also has a variety of other helpful methods for working with result sets. For […]

4
Php

Extend Input Class in Laravel – 4

There is no Input class in Laravel, instead it uses Request class for any Input::method() calls. Basically, we extend a class in OOP language to add some extra functionalities to a base (already created) class and in PHP, for example, if you have following class class BaseClass { public function hello() { echo “Say Hello!”; […]

47
Php

Laravel 4 View Composer and Master layout

In Laravel 4 there is a very nice way to bind data automatically with a view using a View Composer. View composers are callbacks or class methods that are called when a view is created. If you have data that you want bound to a given view each time that view is created throughout your […]

21
Php

Laravel 3 Custom Validation Rule

Laravel provides a number of powerful validation rules including custom validation rules. All of these validation rules are really very handy and easy to use, using these rules (for image validation) you can set allowed mime types for the image, max or min image size in kilobytes etc, for example, to set rules to allow […]

6
Php

Laravel 3 Helper Functions

Laravel is a clean and classy framework for PHP web development and I’m getting familiar with it and I’m really loving it. Well, Laravel has it’s nice documentation for everything but I didn’t find any documentation on it’s helper functions and I didn’t understand why they didn’t provide any documentation for those really helpful helper […]

0
Php

Using Anonymous Functions in Laravel 3

I was using Laravel, the PHP framework for the first time for one of my web applications here and it (Laravel) is really awesome. Laravel uses one of the new (since PHP 5.3) feature that is anonymous function or closure (also known as lambada function) in many places including the Validator class and it lets the developer […]