Welcome Guest, Not a member yet? Register   Sign In
Help migration 3x to 4x
#1
Exclamation 
(This post was last modified: 10-07-2020, 07:13 AM by guilhermepalange.)

Hello, I am updating the version of Codeigniter, I am facing some problems. I have a folder called Template and inside it I have some code, when calling these templates, they generate an error and so far I have not been able to solve, below is my code.

PHP Code:
<?php

namespace Config;

use 
CodeIgniter\Config\AutoloadConfig;

class 
Autoload extends AutoloadConfig
{    
    public 
$psr4 = [
        
APP_NAMESPACE => APPPATH// For custom app namespace
        
'Config'      => APPPATH 'Config',
        
'Libraries' => APPPATH .'/Libraries/My_parser.php',
        
'Preferencia' => APPPATH .'/Libraries/Preferencia.php',
        
'Traducao' => APPPATH .'/Libraries/Traducao.php',
        
'Service' => APPPATH .'/Config/Services',
        
'Menus' => APPPATH .'/Libraries/Menus.php' 
    
];

    public 
$classmap = [];



My ControllerBase:
PHP Code:
<?php
namespace App\Controllers;

use 
CodeIgniter\Controller;
use 
App\Libraries\My_parser;
use 
App\Libraries\Preferencia;
use 
App\Models\index_model;
use 
App\Libraries\Traducao;
use 
App\Libraries\Menus;

class 
BaseController extends Controller
{

    protected 
$helpers = [];
    public function 
initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
    {
        
// Do Not Edit This Line
        
parent::initController($request$response$logger);
        
$this->_db = \Config\Database::connect();
        
$this->My_parser = new My_Parser();
        
$this->preferencia = new Preferencia();
        
$this->_model = new \App\Models\index_model();
        
$this->traducao = new Traducao();
        
$this->menus = new \App\Libraries\Menus();
        
//$this->$session = \Config\Services::session($config);
    
}

    
      public function 
output($data$status){
        
$this->output
        
->set_status_header(200)
        ->
set_content_type('application/json''utf-8')
        ->
set_output(
          
json_encode(
            array(
              
'status'=> $status,
              
'response'=> $data    
            
), 
            
JSON_PRETTY_PRINT JSON_UNESCAPED_UNICODE JSON_UNESCAPED_SLASHES
          
)
        )->
_display();
        exit;
      }
    
    }

  class 
Usuario extends BaseController{
      
    public 
$usuario = array();
  
    public function 
__construct(){
  
      
parent::__construct();
  
      
// verifica se existe sessão
      
if(!$this->session->has_userdata('id')){
        
$this->session->sess_destroy();
        
redirect("app-admin/logout");    
      }
  
    }
  
    public function 
getUsuario(){
      return 
$this->usuario;
    }


please help-me, and sorry my bad english

Good day Guys
Reply


Messages In This Thread
Help migration 3x to 4x - by guilhermepalange - 10-07-2020, 07:11 AM
RE: Help migration 3x to 4x - by guilhermepalange - 10-07-2020, 07:12 AM
RE: Help migration 3x to 4x - by InsiteFX - 10-07-2020, 01:44 PM
RE: Help migration 3x to 4x - by guilhermepalange - 10-07-2020, 05:16 PM
RE: Help migration 3x to 4x - by InsiteFX - 10-08-2020, 03:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB