skip to Main Content

Laravel Socialite Google OAuth with Sanctum: Session created but user_id is null after login

I'm building an API-only SPA with Laravel Sanctum and Nuxt3, using cookie-based session authentication. I’ve implemented Google OAuth using Laravel Socialite. Here’s my current setup for the Google OAuth flow: public function googleCallback() { $googleUser = Socialite::driver('google')->stateless()->user(); $user = $this->authRepository->show($googleUser->email);…

VIEW QUESTION

Laravel – Optimize aggregate queries

I have a query like $products = Product::query()->where(...).... I want to read the maximum dimensions for my double range sliders something like: $dimensionLimits = [ 'width' => [ 'min' => $products->min('width'), 'max' => $products->max('width') ], 'height' => [ 'min' =>…

VIEW QUESTION

Laravel – Accessing path params of FormRequest

I have this code: class BunnyUpdateRequest extends FormRequest { public function authorize(): bool { return true; } public function rules(): array { return [ 'id' => ['required', 'min:1'], 'status' => ['required', Rule::enum(BunnyStatus::class)] ]; } public function validationData(){ return array_merge($this->all(), […

VIEW QUESTION

Laravel – Splitting up query with join, using load in strict mode

I wrote a code something like this: $bunnies = Bunny::with(['carrots' => function ($query) use ($request){ if (empty($request->carrotStatus)) return; $query->where('status', $request->carrotStatus); }, 'owner']) ->select('bunnies.*') ->join('carrots', 'bunnies.id', '=', 'carrots.bunny_id') ->where(function (Builder $query) use ($request){ if (empty($request->carrotStatus)) return; $query->where('carrots.status', $request->carrotStatus); }) ->where(function (Builder…

VIEW QUESTION
Back To Top
Search