Welcome Guest, Not a member yet? Register   Sign In
How to setup another modules with new route files?
#1
Lightbulb 

I want to create many modules for my applications. After trying very hard i have finally added another module with controller. It is working. But there are some redundancy I want to avoid. And I want to make these modules reusable. That is why I want some suggestions on how I can do that.
It would be very helpful if anyone can help me with writing and adding a new route file in app/Config/Routes.php for a new new module URI mapping. i am not that good with searching that is why I need some direct knowledge about these.
Reply
#2

for new module 
PHP Code:
<?php namespace Modules\App\Config;

use 
CodeIgniter\Config\BaseConfig;

class 
ModuleAppConfig extends BaseConfig
{
    /*
  *---------------------------------------------------------------
  *  x directory
  *---------------------------------------------------------------

  */
    public $xDirectory __DIR__ '/../../../public/upload/x';


Code:
<?php namespace Modules\App\Config;


use Config\Services as BaseService;

class Services extends BaseService
{
    //--------------------------------------------------------------------



}

route.php 

Code:
<?php

/*
* modules\App route.file.
*/

$routes->group('api', ['namespace' => 'Modules\App\Controllers'], function ($routes) {

    $routes->resource('overView');
    $routes->resource('graph');

});
Enlightenment  Is  Freedom
Reply




Theme © iAndrew 2016 - Forum software by © MyBB