我将一个laravel项目从一台计算机移动到另一台计算机,我遇到了溃败的错误。奇怪的是,上一台计算机上的网址有http://localhost:8000/public/order/create但在新计算机上http://localhost:8000/order/create
如果我手动添加公共,它仍然无法正常工作。有什么想法吗?
错误:
NotFoundHttpException in RouteCollection.php line 161:
in RouteCollection.php line 161
at RouteCollection->match(object(Request)) in Router.php line 823
at Router->findRoute(object(Request)) in Router.php line 691
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54
at require_once('/Users/mccray/Desktop/owe/public/index.php') in server.php line 21
路线档案:
Route::group(['middleware' =>[ 'web']], function () {
Route::any('user/login', ['as' => 'user.login', 'uses' => 'UserController@login']);
Route::any('user/dologin', ['as' => 'user.dologin', 'uses' => 'UserController@dologin']);});
Route::group(['middleware' =>[ 'web','auth']], function () {
Route::any('/', function () { return view('user.dashboard'); });
Route::any('user/dashboard', ['as' => 'user.dashboard', 'uses' => 'UserController@dashboard']);
Route::any('user/logout', ['as' => 'user.logout' , 'uses' => 'UserController@logout']);
Route::any('sos/create', ['as' => 'sos.create', 'uses' => 'SosController@create']);
Route::any('sos/index', ['as' => 'sos.index' , 'uses' => 'SosController@index']);
Route::any('sos/store', ['as' => 'sos.store' , 'uses' => 'SosController@store']);
Route::any('sos/show/{id}', ['as' => 'sos.show' , 'uses' => 'SosController@show']);
Route::any('sos/edit/{id}', ['as' => 'sos.edit' , 'uses' => 'SosController@edit']);
Route::any('sos/update/{id}', ['as' => 'sos.update' , 'uses' => 'SosController@update']);
Route::any('sos/destroy/{id}', ['as' => 'sos.destroy' , 'uses' => 'SosController@destroy']);
Route::any('sos/submit/{id}', ['as' => 'sos.submit' , 'uses' => 'SosController@submit']);
Route::any('sos/approve/{id}', ['as' => 'sos.approve' , 'uses' => 'SosController@approve']);
Route::any('sos/reject/{id}', ['as' => 'sos.reject' , 'uses' => 'SosController@reject']);
Route::any('sos/customer-search', ['as'=>'sos.customer-search','uses'=>'SosController@search']);
Route::any('sos/customer-selected', ['as'=>'sos.customer-selected','uses'=>'SosController@customerSelected']);
Route::any('order/create', ['as' => 'order.create', 'uses' => 'OrderController@create']);
Route::any('order/index', ['as' => 'order.index' , 'uses' => 'OrderController@index']);
Route::any('order/store', ['as' => 'order.store' , 'uses' => 'OrderController@store']);
Route::any('order/show/{id}', ['as' => 'order.show' , 'uses' => 'OrderController@show']);
Route::any('order/edit/{id}', ['as' => 'order.edit' , 'uses' => 'OrderController@edit']);
Route::any('order/update/{id}', ['as' => 'order.update' , 'uses' => 'OrderController@update']);
Route::any('order/destroy/{id}', ['as' => 'order.destroy' , 'uses' => 'OrderController@destroy']);
Route::any('order/submit/{id}', ['as' => 'order.submit' , 'uses' => 'OrderController@submit']);
Route::any('order/approve/{id}', ['as' => 'order.approve' , 'uses' => 'OrderController@approve']);
Route::any('order/reject/{id}', ['as' => 'order.reject' , 'uses' => 'OrderController@reject']);
Route::any('order/customer-search', ['as'=>'order.customer-search','uses'=>'OrderController@search']);
Route::any('order/customer-selected', ['as'=>'order.customer-selected','uses'=>'OrderController@customerSelected']);
Route::any('order/ship_to_address_area', ['as'=>'order.ship_to_address_area','uses'=>'OrderController@ship_to_address_area']);
Route::any('order/dept_name_field', ['as'=>'order.dept_name_field','uses'=>'OrderController@dept_name_field']);
Route::any('equipment/create', ['as' => 'equipment.create', 'uses' => 'EquipmentController@create']);
Route::any('equipment/index', ['as' => 'equipment.index' , 'uses' => 'EquipmentController@index']);
Route::any('equipment/store', ['as' => 'equipment.store' , 'uses' => 'EquipmentController@store']);
Route::any('equipment/show/{id}', ['as' => 'equipment.show' , 'uses' => 'EquipmentController@show']);
Route::any('equipment/edit/{id}', ['as' => 'equipment.edit' , 'uses' => 'EquipmentController@edit']);
Route::any('equipment/update/{id}', ['as' => 'equipment.update' , 'uses' => 'EquipmentController@update']);
Route::any('equipment/destroy/{id}', ['as' => 'equipment.destroy' , 'uses' => 'EquipmentController@destroy']);
Route::any('equipment/loadManufacturer', ['as'=>'equipment.loadManufacturer','uses'=>'EquipmentController@loadManufacturer']);
Route::any('equipment/loadMachine', ['as'=>'equipment.loadMachine','uses'=>'EquipmentController@loadMachine']);
Route::any('equipment/loadModel', ['as'=>'equipment.loadModel','uses'=>'EquipmentController@loadModel']);
Route::any('equipment/loadImage', ['as'=>'equipment.loadImage','uses'=>'EquipmentController@loadImage']);});
登录页面和设备页面有效,但SOS和订单路由没有。
我使用的是php artisan serve
这是订单控制器的一部分:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\So;
use App\Models\Order;
use App\Models\Customer;
use App\Models\Equipment;
use App\Models\User;
use App\Models\Leasing;
use Illuminate\Support\Facades\Auth;
use Session;
use DB;
use Redirect;
use Illuminate\Support\Facades\Input;
use Carbon\Carbon;
use Mail;
class OrderController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//create a variable and store all the blog posts in it from the dataabse
$orders = Order::all();
//return a view and pass in the above varaible
return view('order.index')->with('orders', $orders);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
这里是路线列表
php artisan dump-autoload
[Symfony的\元器件\控制台\异常\ CommandNotFoundException]
命令&#34; dump-autoload&#34;没有定义。
composer dump-autoload
Warning: This development build of composer is over 60 days old. It is recommended to update it by running "/usr/local/bin/composer self-update" to get the latest version.
Generating autoload files
答案 0 :(得分:0)
在命令行fire下面命令然后尝试访问url
php artisan serve --host=localhost --port=8000
答案 1 :(得分:0)
我从WAMP切换到XAMP并且有效。