I don’t know if I’m doing it wrong, but in Sim 3 I sent the POST from the Controller to the Model and treated it, but in Slim 4 I’m not able to do that, it always gives the error:
Too few arguments to function App\Model\Login::__construct(), 0 passed in D:\SITE\portal\app\Controllers\LoginController.php on line 23 and exactly 2 expected
LoginController.php
<?php
namespace App\Controllers;
use DI\Container;
use App\Support\Redirect;
use App\Model\User;
use App\Model\Login;
class LoginController
{
private $container;
public function __construct(Container $container)
{
$this->container = $container;
}
public function store($response)
{
Login::valida_login($response);
}
}
Login.php
<?php
namespace App\Model;
use Di\Container;
class Login
{
protected static $instance = null;
private $db;
protected static $container;
const LOGIN_VAR = 'Login::usuario_logado';
const LOGIN_PAGE = '/login';
public function __construct(Container $container, Login $login)
{
$this->login = $login;
$this->db = $container->get('connection');
}
public static function valida_login($post)
{
dd($post);
}
}