0
我試圖第一次發送使用模型,並陷入混亂。當我運行查詢時,規則與它鏈接,是否應該是這樣?Laravel 3 - 雄辯查詢返回規則
型號:
class User extends Elegant
{
public static $table = 'users';
protected $rules = array(
'email' => 'required|email',
'firstname' => 'required',
'lastname' => 'required',
'initials' => 'required|alpha|match:/[A-Z]+/',
'role' => 'required|in:writer_fr,writer_en,reader',
'password' => 'min:6,max:32|same:password2'
);
public static function has_role($role)
{
//$u = new User;
$users = User::where($role, '=', 1)->get(array('firstname', 'lastname'));
return $users;
}
}
控制器
$u = array();
$u['writer_en'] = User::has_role('writer_en');
dd($u['writer_en']);
打印出整個模型的規則,消息關係等的邏輯。我做錯了什麼或這是正常的?
確定謝謝你,我只是想確保執行整個用戶邏輯是正常的:) – veksen
不客氣:-) –
並將整個變量傳遞給您建議反對的視圖,或者我應該準備它第一? – veksen