![]() |
Please, I can't solve the problem. When I call the method it displays an error. Even if the method is empty. I didn't find any typos. codeigniter 4
This is the code ![]() This is the code: //controler <?php namespace App\Controllers; use App\Models\DestaqueModel; class Home extends BaseController{ protected $destaqueModel; public function __contruct(){ $this->destaqueModel= new DestaqueModel(); } public function index() { $destaques=$this->destaqueModel ->getDestaque(); //dd($destaques); return view('home/index'); } } //model <?php namespace app\Models; use App\Models\BaseModel; use CodeIgniter\Model; class DestaqueModel extends BaseModel{ //class BaseModel extends Model { } protected $table="destaque"; protected $useSoftDeletes='true'; protected $deletedField='deleted_at'; protected $createdField='created_at'; protected $updatedField='updated_at'; protected $useTimestamps='true'; protected $beforeInsert = ['vinculaIdUsuario','geraChave']; protected $deforeDelete = ['']; protected $allowedFields = [ 'usuario_id', 'chave', 'data_pgto', 'data_inicio', 'data_fim', 'tipo' ]; protected $validationRules = [ 'tipo' =>[ 'label'=>'Tipo', 'rules'=>'required' ] ]; /** * Busca os destaques entre o dia inicial e dia final */ public function getDestaque() { $this->select( " 'id_destaque', 'usuario_id', 'chave', 'data_pgto', 'data_inicio', 'data_fim', 'tipo' "); return $this->findAll(); } }
Please add [SOLVED] to your Title when the problem is solved. I did it for you this time.
Thank you, Forum Moderators. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |