0
イムは、コントローラにコントローラをリダイレクトしようとしているが、イムはRouteCollection.phpライン218にMethodNotAllowedHttpExceptionを取得してコントローラにコントローラをリダイレクト:エラーと私は理解しているようだカントいただきました!間違っLaravel VAR
commentcontroller:
<?php
namespace App\Http\Controllers;
use Session;
use Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class commentcontroller extends Controller
{
public function create()
{
$linked_to_post = Request::input('linked_to_post');
$creator_id = Request::input('creator_id');
$comment = Request::input('comment');
DB::table('comments')->insert(['linked_to_post'=>$linked_to_post,'creator_id'=>$creator_id,'content'=>$comment]);
return redirect()->action('[email protected]', ['redirectid' => $linked_to_post]);
}
のPostController:
<?php
namespace App\Http\Controllers;
use App\Users;
use Session;
use App\posts;
use Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class postcontroller extends Controller
{
public function post(){
if (isset($redirectid)) {
$currentid = $redirectid;
}else{
$currentid = request::input('hiddenpostid');
}
$users = users::getusers();
$posts = posts::getposts();
foreach ($posts as $post) {
if ($currentid == $post->post_id) {
$currentpost = $post;
}
}
return view('post',['posts'=>$currentpost]);
}
経路:
Route::get('/', function() {
return view('welcome');
});
Route::get('new','[email protected]');
Route::get('admin','[email protected]');
Route::get('blog','[email protected]');
Route::post('createpost','[email protected]');
Route::post('registeruser','[email protected]');
Route::post('loginuser','[email protected]');
Route::post('logoutuser','[email protected]');
Route::post('post','[email protected]');
Route::post('submitcomment','[email protected]');