【发布时间】:2022-01-21 05:42:29
【问题描述】:
我正在尝试编辑某人的预制脚本,因为原所有者已经有几年没有更新它了,而且我无法联系到他们。我认为脚本是用 Laravel 编写的,但我不知道他们使用的是什么版本。目前它似乎不适用于最新的 laravel 版本 8
现在我的问题是当我尝试登录时会报错:
Illuminate \ Routing \ Exceptions \ UrlGenerationException Missing [Route: dashboard.profiles.show] [URI: 仪表板/{profile}]。
有谁知道如何解决这个问题?这里有一些我认为与错误有关的文件
web.php 路由
use Illuminate\Support\Facades\Route;
Auth::routes(['verify' => true]);
Route::get('social/{provider}', 'Auth\SocialiteController@redirectToProvider')->name('auth.socialite');
Route::get('social/{provider}/callback', 'Auth\SocialiteController@handleProviderCallback');
Route::get('/', 'HomeController@index')->name('home');
Route::get('about', 'PageController@about')->name('pages.about');
Route::get('privacy', 'PageController@privacy')->name('pages.privacy');
Route::get('terms', 'PageController@terms')->name('pages.terms');
Route::get('press', 'PageController@press')->name('pages.press');
Route::get('l/{uid}', 'LinkController@show')->name('links.show');
Route::middleware('auth')->group(function () {
Route::view('subscribe', 'subscribe');
Route::get('account', 'UserController@edit')->name('users.edit');
Route::patch('account', 'UserController@update');
Route::patch('account/password', 'UserController@changePassword');
Route::post('referral/invites', 'ReferralController@invites')->name('referral.invites');
});
Route::get('sitemap.xml', 'SitemapController@sitemap')->name('sitemap');
Route::get('{profile}', 'ProfileController@show')->name('profiles.show');
dashboard.php 路由
use Illuminate\Support\Facades\Route;
Route::group(['middleware' => 'verified'], function () {
Route::get('profile/create', 'ProfileController@create')->name('profiles.create');
});
// api
Route::group(['prefix' => 'api/{profile}'], function () {
Route::get('/edit', 'ProfileController@edit');
Route::put('/update', 'ProfileController@update');
Route::post('/create', 'ProfileController@store');
Route::put('theme/update', 'ProfileController@update');
Route::put('/links/create', 'LinkController@store');
Route::delete('/links/{link}', 'LinkController@destroy');
Route::put('/links/{link}', 'LinkController@update');
Route::put('/links/{link}/resort', 'LinkController@resort');
});
Route::get('{profile}', 'ProfileController@show')->name('profiles.show');
ProfileController.php
<?php
namespace App\Http\Controllers;
use App\Models\Profile;
use Illuminate\Http\Request;
class ProfileController extends Controller
{
/**
* Display the specified resource.
*
* @param Profile $profile
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function show(Profile $profile)
{
$profile->viewed();
return view('profiles.show', compact('profile'));
}
}
【问题讨论】: