调用资源路由时,服务器就会死机。导致GET http://localhost:8000/tag net :: ERR_EMPTY_RESPONSE。
通过php artisan服务在localhost:8000上* nix框。 ff和Chrome的结果相同。
使用的Ajax是$ .get
路线:
Route::group(['middleware' => 'auth'], function(){
Route::resource('business', 'BusinessesController');
Route::resource('business.show', 'BusinessesController');
Route::resource('business.create', 'BusinessesController');
Route::resource('business.update', 'BusinessesController');
Route::get('order', ['as' => 'order.default', 'uses' => 'BusinessesController@create']);
Route::post('order', ['as' => 'order.post', 'uses' => 'BusinessesController@signUp']);
Route::resource('tag', 'TagController');
});
Route::auth();
所有路线都有效,但'tag'除外。此外,运行php artisan route:list会导致分段错误。
以下作品:
Route::get('tag', function(){
$tags = App\Tag::get()->toArray();
return $tags;
});
控制器:
<?php
namespace App\Http\Controllers;
use App\Http\Middleware\TagService;
use Illuminate\Http\Request;
use App\Http\Requests;
class TagController extends Controller
{
private $_ts;
public function __construct(TagService $tagService)
{
$this->_ts = $tagService;
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
dd('test');
return $this->_ts->get();
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
dd($request->all());
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* 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)
{
//
}
}
请求似乎没有进入控制器。