初始化

This commit is contained in:
2026-08-08 18:27:38 +08:00
parent efc150c937
commit 060eb79c09
336 changed files with 24613 additions and 15 deletions
@@ -0,0 +1,47 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
class RegisterController extends Controller
{
public function show(): View
{
return view('auth.register');
}
public function store(Request $request): RedirectResponse
{
$data = $request->validate([
'name' => ['required', 'string', 'max:40'],
'email' => ['required', 'email', 'max:120', 'unique:users,email'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
'real_name' => ['nullable', 'string', 'max:40'],
'phone' => ['nullable', 'string', 'max:30'],
'company' => ['nullable', 'string', 'max:120'],
'industry' => ['nullable', 'string', 'max:60'],
]);
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => $data['password'],
'real_name' => $data['real_name'] ?? null,
'phone' => $data['phone'] ?? null,
'company' => $data['company'] ?? null,
'industry' => $data['industry'] ?? null,
]);
Auth::login($user);
$user->awardPoints(20);
return redirect('/');
}
}