0

I am new in Laravel. My view is not for the controller why it is . my view : `

<div class="imgcontainer">

    <img src="img/img_avatar2.png" alt="Avatar" class="avatar">

</div>

<div class="container">

    <label><b>Username</b></label>

    <input type="text" placeholder="Enter Username" name="uname" required>

    <label><b>Password</b></label>

    <input type="password" placeholder="Enter Password" name="psw" required>

    <button type="submit">Login</button>

    <input type="checkbox" checked="checked"> Remember me

</div>

<div class="container" style="background-color:#f1f1f1">

    <span class="psw">Forgot <a href="#">password?</a></span>

    <span class="signup">New user <a href="signup">Sign Up?</a></span>

</div>

<div>

    <button type="button" class="cancelbtn">Cancel</button>

</div>

`

my controller is:

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
{
    public $restful = true;

    public function showLogin()
    {
        // show the form
        return View::make('HomeController.login');
    }

    public function doLogin()
    {
        // process the form
    }
}

1 Answer 1

2

You should add:

use View;

after line:

use Illuminate\Http\Request;

without it, you are trying to use View from current namespace and this is App\Http\Controllers

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

2 Comments

it was not correct I get this error now * Find the given view in the list of paths. param string $name param array $paths return string throws \InvalidArgumentException protected function findInPaths($name, $paths) {foreach ((array) $paths as $path) { foreach ($this->getPossibleViewFiles($name) as $file) { if ($this->files->exists($viewPath = $path.'/'.$file)) { return $viewPath;} }} throw new InvalidArgumentException("View [$name] not found."); }
I got the correction that it should be remove controller name from the return statement and it should be only view name. like return View::make('login');

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.