问题是如何通过数据库模型进行验证,我有模型“电子邮件”。我只是希望人们可以注册,如果他们的电子邮件已经在我们的电子邮件模型中。
电子邮件数据库表
Schema::create('emails', function (Blueprint $table) {
$table->increments('id');
$table->text('username')->nullable();
$table->text('fullname')->nullable();
$table->text('description')->nullable();
$table->text('email')->nullable();
$table->timestamps();
});
Run Code Online (Sandbox Code Playgroud)
Auth@RegisterController
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|max:255|unique:users', here i guess
'password' => 'required|min:6|confirmed',
]);
}**strong text**
Run Code Online (Sandbox Code Playgroud) 如何自动删除7天后创建的数据库记录?我是否必须放置在index.blade.php 或其他内容中?也许有一些调度程序?
public function index()
{
$results = Test::orderBy('created_at', 'desc')->take(5)->get();
if (!Auth::user()->isAdmin()) {
$results = $results->where('user_id', '=', Auth::id());
}
return view('results.index', compact('results'));
}
Run Code Online (Sandbox Code Playgroud)