Welcome Guest, Not a member yet? Register   Sign In
Call Model function from Controller
#4

You need to tell your model what table to use, most of the CodeIgniter Model parameters
need to be setup in your model. I would open the system/Model.php and take a look at all
the parameters it has to offer.

PHP Code:
<?php namespace App\Models;

use 
CodeIgniter\Model;

class 
ParticipantModel extends Model
{
    /**
     * -------------------------------------------------------------------
     * Class properties go here.
     * -------------------------------------------------------------------
     *
     * public, private, protected, static and const.
     */


    /**
     * Name of database table
     *
     * @var string
     */
    protected $table 'your_table_name';

    public function participants_total()
    {
        // (some sql query here and return result)
    }


With that you should be able to use any of the CodeIgniter Model's methods.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
Call Model function from Controller - by bustersg - 09-27-2019, 08:24 PM
RE: Call Model function from Controller - by InsiteFX - 09-17-2020, 04:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB