How to get the ids of all inner sub categories in laravel

Get the ids of all inner sub categories in laravel Example models, app/models/Category.php <?php class Category extends Eloquent { /** * This will relate the current category to the categories having parent_id value as $this->id */ public function children() { return $this->hasMany(‘Category’, ‘parent_id’); } /** * This will return the ids array which contains the […]

Continue reading


How to write a test case in laravel using phpunit

Test Case in Laravel with phpunit <?php namespace Alo\Tracker; /** * Description of TaskAPIControllerTest * * @author */ class TaskAPIControllerTest extends \TestCase { public function testIndex() { $crawler = $this->client->request(‘GET’, ‘apiv1/tasks’); $this->assertResponseOk(); } } Create a php file inside app/tests folder, name the file such that it ends with prefix Test, and extend TestCase class.

Continue reading


Laravel useful libraries and links

Laravel useful libraries and links http://laravel-seo.gopagoda.com/ http://laravel.com/docs/4.2/eloquent#polymorphic-relations http://laravel.com/docs/4.2/packages http://laravel.com/docs/4.2/extending http://laravel.com/docs/4.2/facades#practical-usage http://laravel.com/docs/4.2/queues http://laravel.com/docs/4.2/security http://code.tutsplus.com/tutorials/testing-like-a-boss-in-laravel-models–net-30087

Continue reading


models is not working in laravel packages with namespace

How to create models inside laravel packages with namespace 1. Create the package in laravel php artisan workbench alo/framework –resources 2. Create the models folder inside workbench\alo\framework\src\Alo\Framework folder. The mistake we do in creating models folder usually  will be creating it inside workbench\alo\framework\src folder. And using the namesapace for the files created inside models folder with […]

Continue reading