Millrock February 2016

Laravel 5 route doesn't get to the controller

I have a problem. I just want to add a new route to admin, but this landing always on the home screen. I don't understand why. Could you help me? Thanks

Routes.php:

Route::get('/admin', 'CmsController@index');
Route::get('/', 'HomeController@index');

cmscontroller:

namespace App\Http\Controllers;

use App\Media;
use App\Menu;
use App\Posts;
use App\Sitecontent;
use Illuminate\Http\Request;
use Input;

use App\Fileentry;
use App\Image;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Session;

use App\Http\Requests;
//use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\File;
use Illuminate\Http\Response;

class CmsController extends Controller
{

    public function index()
    {

        return view('backend/pages/cms');
    }


Homecontroller:

namespace App\Http\Controllers;
use App\Media;
use App\Sitecontent;
use Lang;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
use App\Menu;



class HomeController extends Controller {

    public function index()
    {
            return view('frontend/pages/home');
    }

Hi all,

I have a problem. I just want to add a new route to admin, but this landing always on the home screen. I don't understand why. Could you help me? Thanks

Answers


umefarooq February 2016

Hi try this route for your admin access, i hope / before admin making problem

Route::get('admin', 'CmsController@index');
Route::get('admin/{id}', 'CmsController@show');

you can use group

Route::group(['prefix' => 'admin'], function () {
    Route::get('users', function ()    {
        // Matches The "/admin/users" URL
    });
});

Post Status

Asked in February 2016
Viewed 3,770 times
Voted 5
Answered 1 times

Search




Leave an answer