Skip to content

Commit f607815

Browse files
committed
update README
1 parent 7fc026f commit f607815

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,63 @@ class HomeController extends Controller
149149
</x-app-layout>
150150
```
151151
152+
`@stack('page_scripts')`: Similar to `@stack('page_styles')`, this directive is used to push page-specific JavaScript scripts into a stack in your layout file:
153+
154+
```bash
155+
<!-- View file: resources/views/home.blade.php -->
156+
@push('page_styles')
157+
<link rel="stylesheet" href="path/to/home-styles.css">
158+
@endpush
159+
160+
<!-- View file: resources/views/home.blade.php -->
161+
@push('page_scripts')
162+
<script src="path/to/home-scripts.js"></script>
163+
@endpush
164+
165+
```
166+
167+
Using the `@section('title', 'Home Page')` directive, you're defining the title of the page as "Home Page". This value will replace the `@yield('title')` directive in your layout file.
168+
Within the layout, you'll have access to the title value defined in this view.
169+
170+
It looks like you're using Blade directives to define the title and content for the home.blade.php view within the x-web-app-layout. Here's the corrected version:
171+
172+
```bash
173+
<!-- resources/views/home.blade.php -->
174+
<x-web-app-layout>
175+
@section('title', 'Home Page')
176+
177+
<h1>Front-End 👋</h1>
178+
179+
<!-- Your additional content goes here -->
180+
</x-web-app-layout>
181+
```
182+
- And you title Controller can also pass from
183+
```bash
184+
<?php
185+
186+
namespace App\Http\Controllers;
187+
188+
use Illuminate\Http\Request;
189+
190+
class HomeController extends Controller
191+
{
192+
public function index()
193+
{
194+
#/yourproject/config/layout-assets.php
195+
# You can add more as per your requirement
196+
# ex addWebAsset(['home', '', '']);
197+
addWebAsset(['home', 'jq']);
198+
$data['title'] = 'Home Page';
199+
return view('home', $data);
200+
}
201+
}
202+
203+
<!-- resources/views/home.blade.php -->
204+
<x-web-app-layout>
205+
@section('title', $title)
206+
<h1>Front-End 👋</h1>
207+
</x-web-app-layout>
208+
```
152209
153210
154211

0 commit comments

Comments
 (0)