Closed fitbodylicious closed 10 years ago
If you want to use the Eloquent driver with a model called Admin, it would look like this:
return array(
'multi' => array(
'account' => array(
'driver' => 'eloquent',
'model' => 'Account'
),
'user' => array(
'driver' => 'database',
'table' => 'users'
),
'admin' => array(
'driver' => 'eloquent',
'model' => 'Admin'
),
),
'reminder' => array(
'email' => 'emails.auth.reminder',
'table' => 'password_reminders',
'expire' => 60,
),
);
so I don't have to define which table to use?
Only if you use the database driver, if you use Eloquent models Laravel normally finds the table by itself.
how if I got a model name different with the table name? how do I define it?
thanks alot for your help!
Lets say you have the model Admin and want it to load from the table _authadmin, you would simply do this:
<?php
class Admin extends Eloquent {
protected $table = "auth_admin";
}
Though the official docs has much more information on how to use Eloquent.
ahhh..that's great. thanks alot man for your help! really appreciate!
No problem, happy to help:) Btw you should close the issue.
Hi
I couldn't understand this part:
return array( 'multi' => array( 'account' => array( 'driver' => 'eloquent', 'model' => 'Account' ), 'user' => array( 'driver' => 'database', 'table' => 'users' ) ), 'reminder' => array( 'email' => 'emails.auth.reminder', 'table' => 'password_reminders', 'expire' => 60, ), );
how if I want to add 'admin'?