I’m pretty new to php and mvc framework. Just wondering how I can adjust dashboard data to only show current users invoices,quotes,etc.
I can get the user name
$this->session->userdata(‘user_name’)
but I can’t find the model now how to filter the database
here is the dashboard controller
Any help would be great
Thanks
class Dashboard extends Admin_Controller
{
public function index()
{
$this->load->model('invoices/mdl_invoice_amounts');
$this->load->model('quotes/mdl_quote_amounts');
$this->load->model('invoices/mdl_invoices');
$this->load->model('quotes/mdl_quotes');
$quote_overview_period = $this->mdl_settings->setting('quote_overview_period');
$invoice_overview_period = $this->mdl_settings->setting('invoice_overview_period');
$this->layout->set(
array(
'invoice_status_totals' => $this->mdl_invoice_amounts->get_status_totals($invoice_overview_period),
'quote_status_totals' => $this->mdl_quote_amounts->get_status_totals($quote_overview_period),
'invoice_status_period' => str_replace('-', '_', $invoice_overview_period),
'quote_status_period' => str_replace('-', '_', $quote_overview_period),
'invoices' => $this->mdl_invoices->limit(10)->get()->result(),
'quotes' => $this->mdl_quotes->limit(10)->get()->result(),
'invoice_statuses' => $this->mdl_invoices->statuses(),
'quote_statuses' => $this->mdl_quotes->statuses(),
'overdue_invoices' => $this->mdl_invoices->is_overdue()->get()->result()
)
);
$this->layout->buffer('content', 'dashboard/index');
$this->layout->render();
}
}