编辑器,路由表更新
This commit is contained in:
parent
5a6d74a517
commit
9df6d9b75b
|
@ -27,6 +27,19 @@ public function __construct()
|
|||
$this->data = $data->data;
|
||||
}
|
||||
|
||||
public function ViewEdit(Request $request, $userId): Application|Factory|View|RedirectResponse
|
||||
{
|
||||
// 查找友链
|
||||
$resultBlog = DB::table('blog_link')
|
||||
->find($userId);
|
||||
$this->data['blog'] = [
|
||||
$resultBlog,
|
||||
];
|
||||
// 没有查询到执行删除
|
||||
if ($this->data['blog'][0] == null) return Response::redirectTo(route('console.friends-link.list'));
|
||||
return view('console.friends-link.edit', $this->data);
|
||||
}
|
||||
|
||||
protected function ViewList(Request $request): Factory|View|Application|RedirectResponse
|
||||
{
|
||||
$this->data['request'] = $request;
|
||||
|
@ -45,22 +58,22 @@ protected function ViewList(Request $request): Factory|View|Application|Redirect
|
|||
// 获取数据库信息
|
||||
if (empty($request->page)) $request->page = 0;
|
||||
$this->data['blog'] = DB::table('blog_link')
|
||||
->whereNotIn('blogLocation',[0])
|
||||
->whereNotIn('blogLocation', [0])
|
||||
->orderBy('id')
|
||||
->offset($request->page*10)
|
||||
->offset($request->page * 10)
|
||||
->limit(10)
|
||||
->get()
|
||||
->toArray();
|
||||
$this->data['blogCount'] = DB::table('blog_link')
|
||||
->whereNotIn('blogLocation',[0])
|
||||
->whereNotIn('blogLocation', [0])
|
||||
->orderBy('id')
|
||||
->count();
|
||||
$this->data['webClass'] = [
|
||||
'active' => 'px-3 py-2 text-blue-600 border border-gray-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white',
|
||||
'unactive' => 'px-3 py-2 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white',
|
||||
];
|
||||
$this->data['blogCount'] = ceil($this->data['blogCount']/10);
|
||||
if ($this->data['request']->page > $this->data['blogCount']-1) return Response::redirectTo(route('console.friends-link.list'));
|
||||
$this->data['blogCount'] = ceil($this->data['blogCount'] / 10);
|
||||
if ($this->data['request']->page > $this->data['blogCount'] - 1) return Response::redirectTo(route('console.friends-link.list'));
|
||||
} else {
|
||||
$this->data['blog'] = DB::select("SELECT * FROM xf_index.blog_link WHERE blogName LIKE '%$request->search%' OR blogUrl LIKE '%$request->search%' ORDER BY id");
|
||||
}
|
||||
|
@ -68,16 +81,13 @@ protected function ViewList(Request $request): Factory|View|Application|Redirect
|
|||
return view('console.friends-link.list', $this->data);
|
||||
}
|
||||
|
||||
protected function ViewCheck(Request $request): Factory|View|Application
|
||||
{
|
||||
return view('console.friends-link.check', $this->data);
|
||||
}
|
||||
protected function ViewCheck(Request $request): Factory|View|Application
|
||||
{
|
||||
return view('console.friends-link.check', $this->data);
|
||||
}
|
||||
|
||||
protected function ViewEdit(Request $request) {
|
||||
return view('console.friends-link.edit',$this->data);
|
||||
}
|
||||
|
||||
protected function ViewAdd(Request $request) {
|
||||
return view('console.friends-link.add',$this->data);
|
||||
}
|
||||
protected function ViewAdd(Request $request): Factory|View|Application
|
||||
{
|
||||
return view('console.friends-link.add', $this->data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
use App\Http\Controllers\Console\Link as ConsoleLink;
|
||||
use App\Http\Controllers\Function\Link as UserLink;
|
||||
use App\Http\Controllers\Index;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
@ -44,7 +45,11 @@
|
|||
Route::redirect('list','list/1');
|
||||
Route::get('list',[ConsoleLink::class,'ViewList'])->name('console.friends-link.list');
|
||||
Route::get('check',[ConsoleLink::class,'ViewCheck'])->name('console.friends-link.check');
|
||||
Route::get('edit/{page}',[ConsoleLink::class,'ViewEdit'])->name('console.friends-link.edit');
|
||||
Route::get('edit/{userId}',function ($userId) {
|
||||
$ConsoleLink = new ConsoleLink();
|
||||
$request = new Request();
|
||||
return $ConsoleLink->ViewEdit($request,$userId);
|
||||
})->name('console.friends-link.edit');
|
||||
Route::get('add',[ConsoleLink::class,'ViewAdd'])->name('console.friends-link.add');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user