我不确定将符号链接推送到git repo是否是不好的做法。是否有任何风险或不良理由?
我还没有一个好的答案。如果任何人有好的资源或解释,请分享。
在我制作的Laravel包中,我想将用户重定向到需要参数的控制器操作(在同一个包中).
控制器:
public function postMatchItem(Request $request, $id)
{
$this->validate($request, [
'item_match' => 'required|numeric|exists:item,id',
]);
$spot_buy_item = SpotBuyItem::find($id);
$item = Item::find($request->input('item_match'));
$price = $item->getPrice();
$spot_buy_item_response = new SpotBuyItemResponse();
$spot_buy_item_response->spot_buy_item_id = $id;
$spot_buy_item_response->spot_buy_id = $spot_buy_item->spot_buy_id;
$spot_buy_item_response->item_id = $item->id;
$spot_buy_item_response->user_id = $spot_buy_item->user_id;
$spot_buy_item_response->spot_buy_price = $price;
$spot_buy_item_response->created_ts = Carbon::now();
$spot_buy_item_response->save();
return redirect()->action('Ariel\SpotBuy\Http\Controllers\Admin\SpotBuyController@getPart', [$id]);
}
Run Code Online (Sandbox Code Playgroud)
重定向中的操作与我在routes.php文件中使用的路径相同,以指导用户执行此控制器操作
路线:
Route::get('/part/{id}', 'Ariel\SpotBuy\Http\Controllers\Admin\SpotBuyController@getPart')->where('id', '[0-9]+');
Run Code Online (Sandbox Code Playgroud)
我尝试过这条路径的变化而没有成功,包括SpotBuyController@getPart文档建议(https://laravel.com/docs/5.1/responses#redirects)
注意:我通过命名我的路由routes.php和使用来实现这一点return redirect()->route('route_name', [$id]);,但我仍然想知道如何将包控制器操作传递给该->action()函数.