|
@@ -1,4 +1,5 @@
|
|
|
<?php
|
|
<?php
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
*查询相关联的书
|
|
*查询相关联的书
|
|
|
*mula->attakhata->tika
|
|
*mula->attakhata->tika
|
|
@@ -31,16 +32,17 @@
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
+use App\Http\Resources\RelatedParagraphResource;
|
|
|
use App\Models\RelatedParagraph;
|
|
use App\Models\RelatedParagraph;
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Request;
|
|
|
-use App\Http\Resources\RelatedParagraphResource;
|
|
|
|
|
|
|
+use Illuminate\Http\Response;
|
|
|
|
|
|
|
|
class RelatedParagraphController extends Controller
|
|
class RelatedParagraphController extends Controller
|
|
|
{
|
|
{
|
|
|
/**
|
|
/**
|
|
|
* Display a listing of the resource.
|
|
* Display a listing of the resource.
|
|
|
*
|
|
*
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @return Response
|
|
|
*/
|
|
*/
|
|
|
public function index(Request $request)
|
|
public function index(Request $request)
|
|
|
{
|
|
{
|
|
@@ -56,22 +58,22 @@ class RelatedParagraphController extends Controller
|
|
|
->get();
|
|
->get();
|
|
|
$books = [];
|
|
$books = [];
|
|
|
foreach ($result as $value) {
|
|
foreach ($result as $value) {
|
|
|
- # 把段落整合成书。有几本书就有几条输出纪录
|
|
|
|
|
- if (!isset($books[$value->book_id])) {
|
|
|
|
|
|
|
+ // 把段落整合成书。有几本书就有几条输出纪录
|
|
|
|
|
+ if (! isset($books[$value->book_id])) {
|
|
|
$books[$value->book_id]['book'] = $value->book;
|
|
$books[$value->book_id]['book'] = $value->book;
|
|
|
$books[$value->book_id]['book_id'] = $value->book_id;
|
|
$books[$value->book_id]['book_id'] = $value->book_id;
|
|
|
$books[$value->book_id]['cs6_para'] = $value->cs_para;
|
|
$books[$value->book_id]['cs6_para'] = $value->cs_para;
|
|
|
}
|
|
}
|
|
|
$books[$value->book_id]['para'][] = $value->para;
|
|
$books[$value->book_id]['para'][] = $value->para;
|
|
|
}
|
|
}
|
|
|
- return $this->ok(["rows" => RelatedParagraphResource::collection($books), "count" => count($books)]);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return $this->ok(['rows' => RelatedParagraphResource::collection($books), 'count' => count($books)]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Store a newly created resource in storage.
|
|
* Store a newly created resource in storage.
|
|
|
*
|
|
*
|
|
|
- * @param \Illuminate\Http\Request $request
|
|
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @return Response
|
|
|
*/
|
|
*/
|
|
|
public function store(Request $request)
|
|
public function store(Request $request)
|
|
|
{
|
|
{
|
|
@@ -81,8 +83,7 @@ class RelatedParagraphController extends Controller
|
|
|
/**
|
|
/**
|
|
|
* Display the specified resource.
|
|
* Display the specified resource.
|
|
|
*
|
|
*
|
|
|
- * @param \App\Models\RelatedParagraph $relatedParagraph
|
|
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @return Response
|
|
|
*/
|
|
*/
|
|
|
public function show(RelatedParagraph $relatedParagraph)
|
|
public function show(RelatedParagraph $relatedParagraph)
|
|
|
{
|
|
{
|
|
@@ -92,9 +93,7 @@ class RelatedParagraphController extends Controller
|
|
|
/**
|
|
/**
|
|
|
* Update the specified resource in storage.
|
|
* Update the specified resource in storage.
|
|
|
*
|
|
*
|
|
|
- * @param \Illuminate\Http\Request $request
|
|
|
|
|
- * @param \App\Models\RelatedParagraph $relatedParagraph
|
|
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @return Response
|
|
|
*/
|
|
*/
|
|
|
public function update(Request $request, RelatedParagraph $relatedParagraph)
|
|
public function update(Request $request, RelatedParagraph $relatedParagraph)
|
|
|
{
|
|
{
|
|
@@ -104,8 +103,7 @@ class RelatedParagraphController extends Controller
|
|
|
/**
|
|
/**
|
|
|
* Remove the specified resource from storage.
|
|
* Remove the specified resource from storage.
|
|
|
*
|
|
*
|
|
|
- * @param \App\Models\RelatedParagraph $relatedParagraph
|
|
|
|
|
- * @return \Illuminate\Http\Response
|
|
|
|
|
|
|
+ * @return Response
|
|
|
*/
|
|
*/
|
|
|
public function destroy(RelatedParagraph $relatedParagraph)
|
|
public function destroy(RelatedParagraph $relatedParagraph)
|
|
|
{
|
|
{
|