1

I'm trying to make a test controller, i read its documentation and following the instruction during developer controller and view. But it does not working.

Controller

project/app/http/controllers/TestController.php

<?php 

namespace App\Http\Controllers;

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

class TestController extends Controller {

    /**
     * Show the profile for the given user.
     *
     * @param  int  $id
     * @return Response
     */
    public function index()
    {
        return view('test');
    }

}
?>

Route

Route::get('test', 'TestController@index');

View

project/resources/views/test.blade.php

simple html

I'm testing this controller using http://localhost/project/public/test but it does not work. Can any one guide me where i'm wrong.

5
  • what error show you? Commented Feb 2, 2016 at 7:55
  • @paranoid it showing this The requested URL /project/public/test was not found on this server. Commented Feb 2, 2016 at 7:56
  • 2
    tried this, localhost/project/public/index.php/test ? Commented Feb 2, 2016 at 7:56
  • @VinodVT Thanks its working Commented Feb 2, 2016 at 7:58
  • @PhpDeveloper Check this to remove index.php from url stackoverflow.com/questions/22365021/… Commented Feb 2, 2016 at 8:02

1 Answer 1

0

Use this in your view <a src="{{ route('test') }}">test</a>

Sign up to request clarification or add additional context in comments.

2 Comments

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
@jeff yes it does, it's a matter of him accessing the wrong url from his view. I showed how to echo the right url

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.