Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
作业标题:0907作业
作业内容:完成项目后台页面
<?php
use Illuminate\Support\Facades\Route;
//后台的路由文件
// Route::get('/admin/home',function(){
// dd('我来了');
// });
//定义后台分组
Route::prefix('admin')->name('admin.')->group(function(){
Route::get('home',function(){
//dd('后台首页的显示',route('admin.index'));
return view('admin.welcome');
})->name('index');
//添加对象资源路由
Route::resource('home/user',\App\Http\Controllers\Admin\UserController::class);
//添加权限管理路由
Route::resource('home/purchase',\App\Http\Controllers\Admin\PurchaseController::class);
//添加问题管理路由
Route::resource('home/question',\App\Http\Controllers\Admin\QuestionController::class);
//添加订单管理路由
Route::resource('home/order',\App\Http\Controllers\Admin\OrderController::class);
});
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//显示添加页面
return view('admin.users.add');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//return view('admin.users.aud');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
return view('admin.users.list');
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
return view('admin.users.edit');
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
4.订单管理控制器代码
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class OrderController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('admin.orders.add');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
return view('admin.orders.list');
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
5.权限管理控制器代码
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class PurchaseController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//设置权限
return view('admin.purchase.add');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
return view('admin.purchase.list');
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
6.问题管理控制代码
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class QuestionController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
return view('admin.question.add');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
return view('admin.question.list');
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
8.左侧菜单部分代码
<li class="nav-item">
<a href="#" class="nav-link">
<i class="nav-icon fas fa-copy"></i>
<p>
对象管理
<i class="fas fa-angle-left right"></i>
</p>
</a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="{{ route('admin.user.create')}}" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>添加对象</p>
</a>
</li>
<li class="nav-item">
<a href="{{ route('admin.user.show','user')}}" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>对象列表</p>
</a>
</li>
<li class="nav-item">
<a href="{{ route('admin.user.edit','user')}}" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>审核对象</p>
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="nav-icon fas fa-chart-pie"></i>
<p>
权限管理
<i class="right fas fa-angle-left"></i>
</p>
</a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="{{ route('admin.purchase.create')}}" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>设置权限</p>
</a>
</li>
<li class="nav-item">
<a href="{{ route('admin.purchase.show','user')}}" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>查看已有权限</p>
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="nav-icon fas fa-tree"></i>
<p>
问题管理
<i class="fas fa-angle-left right"></i>
</p>
</a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="{{ route('admin.question.create')}}" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>设置问题</p>
</a>
</li>
<li class="nav-item">
<a href="{{ route('admin.question.show','user')}}" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>查看问题</p>
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="nav-icon fas fa-edit"></i>
<p>
订单管理
<i class="fas fa-angle-left right"></i>
</p>
</a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="{{ route('admin.order.create')}}" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>查看订单</p>
</a>
</li>
<li class="nav-item">
<a href="{{ route('admin.order.show','user')}}" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p>订单统计</p>
</a>
</li>
</ul>
</li>