Thursday, April 13, 2017

NotFoundHttpException in Handler.php line 131: laravel

For some reason I'm getting this error

NotFoundHttpException in Handler.php line 131: No query results for model [App\Modules\Menus\Models\Menu].

I shouldn't be getting this error since I'm not referencing the menu model at all in my dashboard function.

I've done route:clear and route:cache without any success.

Here is my CustomersController

namespace App\Modules\Customers\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use App\Modules\Menus\Models\Menu;
use App\Modules\Customers\Models\Customer;
use DB;
use Validator;
Use Mail;
use Auth;

class CustomersController extends Controller
{
    public function login(Request $request)
    {
        $this->validate($request, [
            'email' => 'required|email',
            'password' => 'required'
        ]);

        if(auth('customer_admin')->attempt(array('email' => $request->input('email'), 'password' => $request->input('password'))))
        {
            if(auth()->guard('customer_admin')->user()->is_activated == '0')
            {
                $this->logout();
                return back()->with('error', 'Please activate your account.');
            }

            return redirect()->route('dashboard');
        }else{
            return back()->with('error', 'Your email/password combination is wrong.');
        }
    }

    public function dashboard()
    {
        echo "dashboard";
    }
}

My web.php routes

Route::get('/signup', [
    'uses' => 'CustomersController@signup',
    'as' => 'customer.signup'
]);

Route::post('/signup', [
    'uses' => 'CustomersController@postSignup',
    'as' => 'post.signup'
]);

Route::get('customer/activation/{token}', [
    'uses' => 'CustomersController@customerActivation',
    'as' => 'activation',
]);

Route::post('/login', [
    'uses' => 'CustomersController@login',
    'as' => 'login'
]);


// CUSTOMER LOGIN
Route::get('/dashboard', [
    'uses' => 'CustomersController@dashboard',
    'as' => 'dashboard'
]);

Route::get('/logout', [
    'uses' => 'CustomersController@logout',
    'as' => 'logout'
]);



via Shiva478

Advertisement