LaravelMarket
Start Laravel Market
Install
$ git clone https://github.com/puuble/laravelMarket.git
$ cd laravelMarket
$ composer install
$ npm install
step 1 (optional)
https://laravel.com/docs/5.3/redis click this link after follow step by step. We required predis !
This step (laravel redis configuration) is optional. if you are choice please config your .env
file.
step 2
Modules and Branch
check this link for more informations. https://www.atlassian.com/git/tutorials/using-branches/
$ git branch <module_name>
$ git checkout <module_name>
$ git push -u origin <module_name>
And sent pull request check this link https://help.github.com/articles/creating-a-pull-request/
Working With Modules on Laravel Market
$ git branch TestModule
$ git checkout TestModule
Now ready to working for modules. We change branch on TestModule.
php artisan module:create <module_name>
This code custom command (module:create
) in Laravel Market from app/Console/Commands
This code mean is created new module in LM
for example
php artisan module:create TestModule
Please Choice Module Root ? [Frontend]:
[0] Frontend
[1] Admin
[2] User
Explain: Looking the app/Modules/
folder. You will see 3 main folders in this folder. The code in the example inserts the Module in these folders. 0 - Frontend 1 Admin 2 User. Why did we do that ? Because Admin and User modules have own middleware and permissions. If you develop Module for User side Choice 2. Frontend is default choice and no guest mode no middleware and no auth etc.
Results:
I choice 0 - Frontend and created successfuly changes. Look at app/modules/TestModule
folder and subfolders.
You will see Controllers
Models
Views
sub folders in the TestModule
.
Go to Controllers
folder check ActionController
.
namespace App\Modules\Frontend\TestModule\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
public function index()
{
//
return 'Hello Laravel Market';
}
step 3 Access Modules on Browsers
Now! We required config/Module.php
.
TestModule write in the frontend area.
'Admin' => [], //admin side module lists
'Frontend' => [
'TestModule'
], // frontend side module lists
'User' => [], // user side module lists
And .. Check Your Browser Example:
http://lm.dev/testModule
Step 4 Views
Check TestModule/Controllers/ActionController
public function index()
{
//
return 'Hello Laravel Market';
}
Change
public function index()
{
//
return view('TestModule::index');
}
And create index.blade.php
in the testModule/Views
folder
Hello Laravel Market from the Turkey
Browser time
http://lm.dev/testModule
Working Models
Create
$ php artisan make:model Modules/Frontend/TestModule/Models/TestModel
Check
<?php
namespace App\Modules\Frontend\TestModule\Models;
use Illuminate\Database\Eloquent\Model;
class TestModel extends Model
{
//
}
Use
use App\Modules\Frontend\TestModule\Models\TestModel;
public function index()
{
//
TestModel::class;
return view('TestModule::index');
}
#Final Step
git push -u origin TestModule
And get pull request