09-15-2019, 08:50 AM
I get ErrorException
Undefined variable: table
APPPATH/Models/OptionsModel.php at line 22
app/Models/OptionsModel.php
Any help will be appreciated. Thanks!
Undefined variable: table
APPPATH/Models/OptionsModel.php at line 22
Code:
22: $option_value = $table->find($item);
app/Models/OptionsModel.php
Code:
<?php namespace App\Models;
use CodeIgniter\Model;
class OptionsModel extends Model
{
protected $DBGroup = 'default';
protected $table = 'options';
protected $primaryKey = 'option_name';
protected $returnType = 'array';
public function get_options($item, $display = 0)
{
$option_value = $table->find($item);
if (empty($option_value)) {
if (!$display) {
return $option_value;
} else {
echo $option_value;
}
}
}
}
Any help will be appreciated. Thanks!