wuwx/laravel-plus-view

v9.0.0 2024-05-29 00:36 UTC

README

Latest Stable Version Total Downloads

安装

快速

通过Composer安装,只需运行以下命令

composer require wuwx/laravel-plus-view

添加服务提供者

接下来在 config/app.php 中添加以下服务提供者。

'providers' => [
    Wuwx\LaravelPlusView\LaravelPlusViewServiceProvider::class,
],

添加Blade模板

index.html.blade.php

<h1>{{ $dataTypeContent->title }}</h1>

index.json.blade.php

{!! json_encode($dataTypeContent) !!}

测试

curl https://:8000/users
curl https://:8000/users?_format=json
curl https://:8000/users -H "Accept: application/json"