Что-то я сегодня не выспался, не могу сделать наибанальнейшую вещь.
mysql> show fields from users;
+------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| first_name | varchar(50) | NO | | NULL | |
| last_name | varchar(50) | NO | | NULL | |
| email | varchar(50) | NO | UNI | NULL | |
| role_id | int(10) unsigned | NO | MUL | NULL | |
| registered | int(10) unsigned | NO | | NULL | |
| country | int(10) unsigned | NO | MUL | NULL | |
| sex | enum('0','1') | NO | | NULL | |
| dob | int(10) unsigned | NO | | NULL | |
| phone | varchar(20) | NO | | NULL | |
| mobile | varchar(20) | NO | | NULL | |
| sport | int(10) unsigned | NO | MUL | NULL | |
| promoted | int(10) unsigned | YES | | NULL | |
| passhash | varchar(40) | NO | | NULL | |
| salt | varchar(10) | NO | | NULL | |
| status | bigint(20) unsigned | NO | | 0 | |
+------------+---------------------+------+-----+---------+----------------+
16 rows in set (0.02 sec)
mysql> show fields from user_roles;
+-------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| role | varchar(20) | NO | UNI | NULL | |
| mask | int(10) unsigned | NO | | NULL | |
+-------+------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)
Как мне описать метод relations, чтобы я мог писать $user->role->mask?
Вообще голова сегодня не хочет работать =\