Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

Commit aa00134

Browse files
committed
update readme
add more views examples
1 parent 46776f2 commit aa00134

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

readme.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,36 @@ class UserController extends Controller
185185
}
186186
}
187187
```
188-
#### view
189-
To access service's view file. just prepend service name followed by two colon ::
188+
#### Views
189+
To access a service's view file, prepend the file's name with the service name followed by two colons `::`
190190

191-
example
191+
Example extending view file in blade:
192192
```
193-
@extends('serivename::index')
193+
@extends('servicename::index')
194194
```
195195

196-
with jobs you can specify path like this
196+
Usage with jobs is similar:
197+
```php
198+
new RespondWithViewJob('servicename::user.login')
197199
```
198-
new RespondWithViewJob('servicename::student.login')
200+
201+
`RespondWithJsonJob` accepts the following parameters:
202+
```php
203+
RespondWithViewJob($template, $data = [], $status = 200, array $headers = []);
204+
```
205+
206+
Usage of template with data:
207+
```php
208+
$this->run(new RespondWithViewJob('servicename::user.list', ['users' => $users]));
209+
```
210+
Or
211+
```php
212+
$this->run(RespondWithViewJob::class, [
213+
'template' => 'servicename::user.list',
214+
'data' => [
215+
'users' => $users
216+
],
217+
]);
199218
```
200219

201220
#### Job

0 commit comments

Comments
 (0)