我是新的Laravel,我正在使用Laravel作为我的角度项目的API。在使用get方法检索数据时,我使用Laravel时没有问题,但是使用post方法将数据插入其中有一个大问题。
我有以下错误:
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The GET method is not supported for this route. Supported methods: POST.
我发誓这是我在api.php的代码
<?php
use App\Models\sample;
use Il
我正在使用一个表单提交我的请求,以更新和删除我的数据从数据库,但我不能这样做。
我试过用不同的方法,但我解决不了这个问题。我在这个项目中使用了Laravel5.4.36。
主计长:
public function update(Request $request, $id)
{
Student::where('id', $id)->update(['first_name' => 'vks', 'last_name' => 'pok']);
}
public function destroy
我正在尝试用laravel处理表单,但我一直遇到这个错误。
Symfony \ Component \ HttpKernel \ MethodNotAllowedHttpException \MethodNotAllowedHttpException此路由不支持GET方法。支持方法: POST。
我试过很多方法来解决它,但没有解决它
我的模特
create_posts_table.php
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illum
我有两个路由:
Route::post('/post_2', 'TestController@post_2')
->name('post_2');
Route::post('/result', 'TestController@result')
->name('result');
和TestController,如下所示。
public function post_2(){
return view('post_2View');
}
public fu
在我的控制器中,我有一个应该重定向到POST路由的方法。我也不能将此路由设置为GET路由。有什么解决方案吗?
我的控制器代码看起来像这样:
// After a bunch of other if statements, etc
return redirect('newUser')->with('user', $user);
现在我的路由(在web.php中)如下:
Route::post('/newUser', function() {
$user=session('user');
dd($user);
我的编辑页面有问题。当我提交时,我会得到以下错误:
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
此路由不支持GET方法。支持的方法: POST
。
我不知道它是从哪里来的,因为我对拉勒维尔非常陌生。
web.php
Route::post('/admin/add_reseller','ResellerController@addReseller');
Controller.php
public function addReseller(){
r
我在从Laravel的数据库中获取一些信息时遇到了一些问题。我尝试使用where方法并指定我需要的id,但我总是遇到这样的错误
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: The GET method is not supported for this route. Supported methods: POST.
这是代码控制器
public function select_category($category_id){
$products = Products::where(
我只是在学习laravel资源方法来构建一个基本的API。下面是我的api.php文件的代码,它显示了所有的API路由。
// List Articles
Route::get('articles', 'ArticleController@index');
// List Single Article
Route::get('article/{id}', 'ArticleController@show');
// Create New Article
Route::post('article', 'Ar