Started a flight view
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\UserFlight;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class FlightProfileController extends Controller
|
||||
{
|
||||
public function view(string $username)
|
||||
{
|
||||
$user = User::whereRaw(DB::raw('LOWER(name) = ?'), [strtolower($username)])->firstOrFail();
|
||||
|
||||
$flights = UserFlight::where('user_id', $user->id)->get();
|
||||
|
||||
return Inertia::render('FlightProfile', [
|
||||
'user' => $user,
|
||||
'flights' => $flights,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user