Welcome Guest, Not a member yet? Register   Sign In
Help understanding routes
#1

Hi,

I am currently messing round with CI4 and I am having issue with understanding the routing.

I have a controller that I just randomly made:

PHP Code:
<?php

namespace App\Controllers;

use 
CodeIgniter\Controller;

class 
Login extends BaseController {
    
     
public function index() {
         
        
        
return view('welcome_message');
    }
    


now if I direct to login it works just fine without a line in routes.  if I add a route like so:

PHP Code:
$routes->get('admin''Login::index'); 


If I now go to /admin then it work and shows me login.  The issue is then if I move Login.php controller into a folder called admin in the controllers folder and change the route to:

PHP Code:
$routes->get('admin''admin/Login::index');

or 

$routes->get('admin''admin\Login::index'); 

I get:


Quote:Controller or its method is not found: \App\Controllers\admin\Login::index


and I cannot for the life of me figure out why this doesn't work.  Can anyone enlighten me on why this isn't working please?

Thanks,

Doomie
Reply


Messages In This Thread
Help understanding routes - by doomie22 - 02-21-2020, 04:10 AM
RE: Help understanding routes - by falko - 02-21-2020, 05:42 AM
RE: Help understanding routes - by doomie22 - 02-21-2020, 09:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB