Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8111461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:07:45+00:00 2026-06-06T02:07:45+00:00

Here is my problem in codeigniter MVC. Suppose I have 3 models: (users, email

  • 0

Here is my problem in codeigniter MVC.

Suppose I have 3 models: (users, email , payments).
When some one paid by some way , controller calls some method of payments model , that method could be called from other controllers too.

That method , does some database insert and update and at the end , it wants to send an email to user , it already has userid , but it needs username , email , which should get from users table and then send email.

I don’t like payments model could have access to users table and I want to get info from users model and send email using email model.

normally I call those from controller , I mean first call payments model and get the result and get users info from users model and then use email model , all in controller .

But because I need to run that model’s method in some controllers , I must repeat those lines and it is not the correct aspect in my point.

Question:
Should I call other models inside model or use other models tables inside model (in this option , if I want to reuse that model I should change it if other tables changed which is not right) , or is there any other way?

The main problem is not exactly that one it is just example of situation .
I also defined some function which does those thing and call from controllers , but it is not right too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:07:48+00:00Added an answer on June 6, 2026 at 2:07 am

    Put it all into a library.

    So your controller calls the library for a “payment”, and passes some details. Your library then does ALL of the features you describe above – i.e. calls the payment model, sends the email etc etc.

    You can learn more about codeigniter libraries here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im newbie here.I have a problem with codeigniter segment() method.I referred 6th segment of
I have a problem here. My Zend_Forms do not render in view script. Via
I have a problem here I can't solve. I have a database of houses
jsFiddle of the problem here. When I have an image with align=left inside a
I have a problem here with this code. I'm opening a socket, then listening
I have a PHP web application built with CodeIgniter MVC framework. I wish to
I have a problem with codeigniter and the .htaccess, I have been looking for
I have a CodeIgniter application, but one of my controllers must call a data
I have created my own mvc pattern based on the codeigniter framework style. My
I have a site using CodeIgniter that is almost complete now. My problem is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.