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

  • SEARCH
  • Home
  • 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 1007021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:33:14+00:00 2026-05-16T08:33:14+00:00

I have a domain for users that connects to my user table, which includes

  • 0

I have a domain for users that connects to my user table, which includes information like username, first name, and last name.

Then I have a domain for emails, that connects to the email table because a user can have more than one email. The email table consists of a fk to connect the user with their emails, and other fields like address, status, etc.

Should I have different domains for the separate tables, but combine functions, that call the domains, in the models? Or maybe you can but it’s not best practice.

I am new to this MVC thing and it’s hurting my brain right now. Maybe, it just someone hasn’t explained it well enough.

  • 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-05-16T08:33:14+00:00Added an answer on May 16, 2026 at 8:33 am

    Question: when you mention having a “Domain”, are you referring to a User model, and an Email model? or to the design pattern?

    Also, initially (but depends on your application) having the email database logic inside the users model is more logical (to me), since I don’t think you are going to add email addresses without creating a user. That is, the email model really depends on the user model, and perhaps only on the user model, so maybe they should be combined?

    The way I would do it:

    1. Put all the database logic inside the models which I assume is the way you have done it.

    2. Create a library or class to place the business logic of the application that concerns users. (For example, uploading an image, or connecting to a web service, should not be in the model if you follow the standard that CodeIgniter models should only contain database logic, so that’s why I create another class to handle those cases)

    3. Now, when you want to create an user, you just inject the models in the library (you could do this at the controller level), and call your abstract method create_user()

    class Users extends Controller {
        public function create() {
            // these could be in the constructor!
            $this->load->model('users');
            $this->load->library('users_logic');
            $this->users_logic->set_model($this->users);
            // and/or: $this->users_logic->set_email_model($this->email_model);
    
            if ($this->input->post('name')) {
                $this->users_logic->create();
            }
        }
    }
    

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

Sidebar

Related Questions

I have a project in mind that will offer users their own domain, like
I have a mobile site and I'd like to redirect users to the domain.mobi
I have SQL Server 2008 to which I can connect using domain user credentials.
I have an application that uses Hibernate for its domain objects. One part of
In my domain: Users have many Bills Bills have many BillItems (and therefore Users
On my domain I have a form workflow where users enter data on one
I have added the following method in my User Domain class String getNameAttribute(){ return
I have a payment page on my website: domain.com/user/payment/product_name and I want to be
I have created an app to standardize user creation for our AD domain. Now
I have the following 2 objects: User and DomainUser User.java: package com.domain; import java.io.Serializable;

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.