CodeIgniter Forums

Full Version: Myth:Auth - Views location
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm missing something that should be pretty clear, so hopeful that someone can easily point me in the right direction.

I installed Myth:Auth with composer, then ran through the various Spark commands to configure it.  The publish command created the new View files, but the Auth config file leaves the vendor path in place.

Code:
Publish Views? [y, n]: y
  created: Views/Auth/emails\activation.php
  created: Views/Auth/emails\forgot.php
  created: Views/Auth/forgot.php
  created: Views/Auth/layout.php
  created: Views/Auth/login.php
  created: Views/Auth/register.php
  created: Views/Auth/reset.php
  created: Views/Auth/_footer.php
  created: Views/Auth/_header.php
  created: Views/Auth/_message_block.php
  created: Views/Auth/_navbar.php
Publish Config file? [y, n]: y
  created: Config/Auth.php

[Image: wkAnI0.jpg]

So I think I need to change the Auth config to match the file path that the publish function used?  I'm tried a few different variations, but the files can't be found and I get 'Whoops' error message.

PHP Code:
//--------------------------------------------------------------------
    // Views used by Auth Controllers
    //--------------------------------------------------------------------

    public $views = [
        'login' => 'Views\Auth\login',
        'register' => 'Views\Auth\register',
        'forgot' => 'Views\Auth\forgot',
        'reset' => 'Views\Auth\reset',
        'emailForgot' => 'Views\Auth\emails\forgot',
        'emailActivation' => 'Views\Auth\emails\activation',
    ];

    //--------------------------------------------------------------------
    // Layout for the views to extend
    //--------------------------------------------------------------------

    public $viewLayout 'Views\Auth\layout'


Code:
log-2021-03-26.log:
CRITICAL - 2021-03-26 15:55:50 --> Invalid file: Views\Auth\login.php
#0 /home/user/path/vendor/codeigniter4/framework/system/View/View.php(203): CodeIgniter\Exceptions\FrameworkException::forInvalidFile('Views\\Auth\\logi...')
#1 /home/user/path/vendor/codeigniter4/framework/system/Common.php(1217): CodeIgniter\View\View->render('Views\\Auth\\logi...', Array, true)
#2 /home/user/path/vendor/myth/auth/src/Controllers/AuthController.php(54): view('Views\\Auth\\logi...', Array)
#3 /home/user/path/vendor/codeigniter4/framework/system/CodeIgniter.php(936): Myth\Auth\Controllers\AuthController->login()
#4 /home/user/path/vendor/codeigniter4/framework/system/CodeIgniter.php(432): CodeIgniter\CodeIgniter->runController(Object(Myth\Auth\Controllers\AuthController))
#5 /home/user/path/vendor/codeigniter4/framework/system/CodeIgniter.php(333): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#6 /home/user/website.com/index.php(44): CodeIgniter\CodeIgniter->run()
#7 {main}
Never mind... I don't know what I did wrong the first time, but I recreated the environment and now it's working.  I still had to change the $view files to the correct path, but at least now it generated the Auth.php file in a way that I understood how it should be.

Before:

PHP Code:
public $views = [
 
'login'   => 'App\Views\login',
 
'register' => 'App\Views\register',
 
'forgot'   => 'App\Views\forgot',
 
'reset'   => 'App\Views\reset',
 
'emailForgot' => 'App\Views\emails\forgot',
 
'emailActivation' => 'App\Views\emails\activation',
 ];

public 
$viewLayout 'App\Views\layout'


After:

PHP Code:
public $views = [
 
'login'   => 'App\Views\Auth\login',
 
'register' => 'App\Views\Auth\register',
 
'forgot'   => 'App\Views\Auth\forgot',
 
'reset'   => 'App\Views\Auth\reset',
 
'emailForgot' => 'App\Views\Auth\emails\forgot',
 
'emailActivation' => 'App\Views\Auth\emails\activation',
 ];
 
public 
$viewLayout 'App\Views\Auth\layout'