初步完成
This commit is contained in:
34
app/Http/Controllers/PatentController.php
Normal file
34
app/Http/Controllers/PatentController.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Patent;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PatentController extends Controller
|
||||
{
|
||||
|
||||
//显示论文详情
|
||||
public function show(Patent $patent)
|
||||
{
|
||||
$next = Patent::where('id', '>', $patent->id)->where('status', 1)->first();
|
||||
|
||||
return view('patents.show', compact('patent', 'next'));
|
||||
}
|
||||
|
||||
//显示文章列表
|
||||
public function list(Request $request)
|
||||
{
|
||||
$type = $request->type;
|
||||
|
||||
$patents = Patent::where('status', 1)
|
||||
->when($type, function ($q) use ($type) {
|
||||
$q->where('type', $type);
|
||||
})
|
||||
->paginate();
|
||||
|
||||
return view('patents.list', compact('patents'));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user