Php Laravel 5.2不带js的其他控制器的行动请求
需要从向导向控制器类别发送请求 向导操作:Php Laravel 5.2不带js的其他控制器的行动请求,php,laravel,post,laravel-5,request,Php,Laravel,Post,Laravel 5,Request,需要从向导向控制器类别发送请求 向导操作: $request = Request::create('/admin/category', 'POST', $this->prepare_category($row->toArray())); Route::dispatch($request); 类别行动: public function store(Request $request, ContentPlugins $plugins) { dd(Request::all());
$request = Request::create('/admin/category', 'POST', $this->prepare_category($row->toArray()));
Route::dispatch($request);
类别行动:
public function store(Request $request, ContentPlugins $plugins)
{
dd(Request::all());
}
请求通过,但request::all()为空[]
应美元请求:
Request {#1922 ▼
#json: null
#userResolver: null
#routeResolver: null
+attributes: ParameterBag {#1859 ▼
#parameters: []
}
+request: ParameterBag {#1726 ▼
#parameters: array:11 [▼
"title" => "Фотосувениры"
"level" => "0"
"description" => null
"cost" => null
"what" => null
"type" => "catalog"
"parent" => 0
"url" => "fotosuveniry-0-0"
"sitemap" => 1
"active" => 1
"position" => 0
]
}
+query: ParameterBag {#1920 ▶}
+server: ServerBag {#1679 ▶}
+files: FileBag {#1728 ▶}
+cookies: ParameterBag {#1727 ▶}
+headers: HeaderBag {#1886 ▶}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: null
#requestUri: null
#baseUrl: null
#basePath: null
#method: null
#format: null
#session: null
#locale: null
#defaultLocale: "en"
}
我需要在Category.php上获得request->parameters
作为$\u POST
(request::all())
提交表单时,如何引起另一个组件的动作并传递参数
这就是我从科哈纳那里需要的
这使用了POST
$request = Request::factory('http://example.com/post_api')- >method(Request::POST)->post(array('foo' => 'bar', 'bar' => 'baz'));
答复:
Input::merge($this->prepare_category($row->toArray()));
以前
$request = Request::create('/admin/category', 'POST');
Route::dispatch($request);