猫言猫语

严以律己·宽以待人·自强不息·知行合一

laravel-plus-view

| laravel-plus-view已关闭评论

Latest Stable Version Total Downloads

Installation

Quick

To install through composer, simply run the following command:

bash
composer require wuwx/laravel-plus-view

Add Service Provider

Next add the following service provider in config/app.php.

php
'providers' => [
WuwxLaravelPlusViewLaravelPlusViewServiceProvider::class,
],

Add Blade Template

index.html.blade.php
blade
<h1>{{ $dataTypeContent->title }}</h1>

index.json.blade.php
blade
{!! json_encode($dataTypeContent) !!}

Test

bash
curl http://localhost:8000/users
curl http://localhost:8000/users?_format=json
curl http://localhost:8000/users -H "Accept: application/json"