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 Alo\Framework, but its of no use if you have not created the folders specified in the namespace. php needs the class file to be exists inside the folders how the namespace was specified, example: Alo\Framework\models\User.php

User.php

<?php
namespace Alo\Framework;

class User extends \Eloquent
{
    // to-do
}

Leave a Reply