Thursday, November 25, 2010

Re: Table / Role / Profile Relations

You could use separate models: Administrator, Buyer, and Seller. Plus
have a User model to handle logins. So users has columns:
email
password
model
foreign_key

In your login() do a switch on $this->Auth->user('model') to decide
where to redirect to.

On Thu, Nov 25, 2010 at 10:00 AM, Dave Maharaj <me@davemaharaj.com> wrote:
> Advise needed.
>
>
>
> I have a new site that has 3 roles. 1 admin and 2 other make it easy call it
> buyer and seller
>
>
>
> Now admin needs no profile only 1 admin in this case…like I said lets keep
> it simple. Now seller has a profile with lots of relations hasmany this and
> that HABTM other things. Where the buyer has only 1 or 2 hasMany. How could
> it be set up so depending on the Users role have a buyer_profile and
> seller_profile so depending on the user type then that's the profile they
> get?
>
>
>
> I know they could share the same but get the buyers profile might have 30
> fields to get which some fields can not be null when saving yet the seller
> has only 10 fields pretty much optional. I figure it would be easier to keep
> the profiles specific to the role so I will not run into validation problems
> where say 5 fields are required  for 1 role and the other the 5 are
> optional.
>
>
>
> Ideas? Thoughts? Suggestions?
>
>
>
> Thanks all.
>
>
>
> Dave
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: