Welcome Guest, Not a member yet? Register   Sign In
Group routing
#1

(This post was last modified: 06-22-2020, 09:13 PM by shyam_samtan.)

What should be the folder structure and controller class name for group routes as example:

$routes->group('admin', function($routes)
{
    $routes->add('users', 'Admin\Users::index');
    $routes->add('blog', 'Admin\Blog::index');
});
Reply
#2

Folder structure will be the same as the second parameter,
like this in your case;


Code:
app/Controllers/Admin/Users.php
app/Controllers/Admin/Blog.php


as for the controller file itself the content will be something like this:


PHP Code:
<?php namespace App\Controllers\Admin;

class 
Users extends Controller
{
    public function 
index()
    {
        //your code goes here----------
    
}

Reply
#3

(06-23-2020, 12:19 PM)inumaru Wrote: Folder structure will be the same as the second parameter,
like this in your case;


Code:
app/Controllers/Admin/Users.php
app/Controllers/Admin/Blog.php


as for the controller file itself the content will be something like this:


PHP Code:
<?php namespace App\Controllers\Admin;

class 
Users extends Controller
{
    public function index()
    {
        //your code goes here----------
    }


Thanks a lot @inumaru
Reply




Theme © iAndrew 2016 - Forum software by © MyBB