Php Laravel:BadMethodCallException方法[store]不存在

Php Laravel:BadMethodCallException方法[store]不存在,php,laravel-4,Php,Laravel 4,我刚刚下载了最新的Laravel4.2并开始了一个新项目。尝试提交表单时,我遇到以下错误:BadMethodCallException方法[store]不存在 这是我的文件:controller-admin/AdminController <?php namespace admin; use Illuminate\Support\Facades\View; use App\Services\Validators\ArticleValidator; use Input, N

我刚刚下载了最新的Laravel4.2并开始了一个新项目。尝试提交表单时,我遇到以下错误:BadMethodCallException方法[store]不存在

这是我的文件:controller-admin/AdminController

<?php
  namespace admin;

  use Illuminate\Support\Facades\View;
  use App\Services\Validators\ArticleValidator;
  use Input, Notification, Redirect, Sentry, Str;

  class AdminController extends \BaseController {

      public function index() {

          if (Input::has('Login')) {

              $rules = array(
                  'email' => 'required',
                  'password' => 'required|min:3',
                  'email' => 'required|email|unique:users'
              );

              $validator = Validator::make(Input::all(), $rules);

              if ($validator->fails()) {
                  return Redirect::to('admin\AdminController')->withErrors($validator);

              } else {

                  // redirect
                  Session::flash('message', 'Successfully created user!');
                  return Redirect::to('admin\AdminController');
              }
          }
          $data['title'] = ADMIN;
          return View::make('admin.index', $data);
      }
  }
错误消息告诉您问题所在:名为
store()
的方法不存在。将其添加到控制器:

<?php
namespace admin;

use Illuminate\Support\Facades\View;
use App\Services\Validators\ArticleValidator;
use Input, Notification, Redirect, Sentry, Str;

class AdminController extends \BaseController {

    public function index()
    {
        // leave code as is
    }

    public function store()
    {
        // this is your NEW store method
        // put logic here to save the record to the database
    }

}

您正在将数据发布到一个不存在的函数
存储
。创建函数或更改发送请求的路径。
POST
请求正在运行…谢谢..但验证不起作用,它显示未找到验证程序。我将验证放在索引方法或存储方法中的位置??正如您命名的控制器,如果您使用
Validator
,它将在您的
admin
命名空间中查找,但显然找不到它。您需要导入
验证器
,就像导入
输入
重定向
Str
等一样。
<?php
namespace admin;

use Illuminate\Support\Facades\View;
use App\Services\Validators\ArticleValidator;
use Input, Notification, Redirect, Sentry, Str;

class AdminController extends \BaseController {

    public function index()
    {
        // leave code as is
    }

    public function store()
    {
        // this is your NEW store method
        // put logic here to save the record to the database
    }

}