我使用laravl 5.2和以下是我的代碼Laravel:方法是在控制器中定義但它說沒有找到方法
我收到錯誤
ReflectionException在Route.php行280: 方法App \ Http \ Controllers \ Signup_controllers :: guestcheckout()不存在
我在做什麼錯? plz幫助
這是我route.php
Route::group(array('prefix' => 'signup'), function()
{
Route::resource('/register', '[email protected]');
Route::resource('/guestcheckout', '[email protected]');
Route::resource('/login', '[email protected]');
Route::resource('/logout', '[email protected]');
Route::resource('/ajaxCheckCustomerEmailExist', '[email protected]');
});
這是我的註冊控制器
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Input;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Session\Session1;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Redirect;
use Image;
use Session;
use DB;
use Mail;
use App\Http\Models\Frm_mailing_list;
use App\Http\Models\Frm_contactus;
use App\Http\Models\Emailautoresponse;
use App\Http\Models\Adminemail;
use App\Http\Models\Emailsetting;
use App\Http\Models\Product_price;
class Signup_controllers extends Controller
{
public function index(Request $request)
{
}
public function register(Request $request)
{
include(public_path().'/app/Http/Controllers/action/register_controllers.php');
}
public function login(Request $request)
{
include(public_path().'/app/Http/Controllers/action/login_controllers.php');
}
public function logout()
{
Session::flush();
return Redirect::away(url('/login-registration'))->send();
}
public function guestcheckout(Request $request)
{
include(public_path().'/app/Http/Controllers/action/guestcheckout_controllers.php');
}
public function ajaxCheckCustomerEmailExist(Request $request)
{
//Checked By Ranjit
$email=$request->email;
$customerData=array('email'=>$email);
$Customer=new Customer;
$resultCustomer=$Customer->getByAttributesQuery($customerData);
if($resultCustomer['recordCount']>0){
echo "false";
}else{
echo "true";
}
}
}
當我嘗試調用guestcheckout它說沒有找到方法,即使我已經將它定義
1)這是一條評論。 2)是什麼讓你認爲控制器使用不當? –
資源控制器只能分配一個控制器,而不是控制器內部的一個方法 'Route :: resource('photos','PhotoController');'' –