jenssegers / jenssegers/agent

Blade with desktop extending layout

Open
#150 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
4.9k
Forks
545
PR merge metrics
No merged PRs in 30d

Description

Hi,

I got a blade file as follows:
```php
@if((new \Jenssegers\Agent\Agent())->isDesktop())
@extends('layouts.app')

@section('content')

DESKTOP VERSION


@endsection
@endif
@if((new \Jenssegers\Agent\Agent())->isMobile())

MOBILE VERSION


@endif
```

The h1 tags are working as expected, on desktop it shows `DESKTOP VERSION` and on mobile it shows `MOBILE VERSION`.

But the same layout `layouts.app` is being rendered on both clients.

I expected the layout to be used only by the desktop, but it's being rendered on mobile too.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the behavior using the supplied Blade view and the layouts.app view with desktop and mobile requests. Inspect how the conditional Blade content and layout extension are processed, then confirm whether the layout is rendered only for desktop or document the required change.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.