14

This is student.php and my function for admin:

 public function admin(Request $request){

       if($request->isMethod('get')){
       return \View::make('/admin');
    }
       else
        {

                 $UserData['email'] = Input::get('username');
                 $UserData['password'] = Input::get('password');
                 User::create($UserData);
                 return 'admintest';
                 //return Redirect::to('/view');
         }
   }   

routes.php

      Route::match(['get', 'post'], '/admin', 'student@admin');

This is admin form:

     {!! Form::open(array('url' => '/admin')) !!}
  <input type="hidden" name="_token" value="{{ csrf_token() }}">


    User Name:<br />
      <input name="username" type="text" id="username" size="40" />
    <br /><br />
    Password:<br />
   <input name="password" type="password" id="password" size="40" />
   <br />
   <br />
   <br />

     <input type="submit" name="button" id="button" value="Log In" />


  {!! Form::close() !!}

Don't know why showing error:

InvalidArgumentException in FileViewFinder.php line 137: View [.] not found

5
  • What is the name of the file, that has admin form ? Give the full name Commented Jul 7, 2015 at 7:19
  • which view are talking about.. i didnt get u Commented Jul 7, 2015 at 7:20
  • You want to return the admin form. Isn't it ? Commented Jul 7, 2015 at 7:21
  • as i just go to open the admin form.. it shows me this error. Commented Jul 7, 2015 at 7:22
  • Yes, What is the name of the file that has the admin form ? Commented Jul 7, 2015 at 7:23

8 Answers 8

33

If you recently deployed you project to your production server or moved the project to another server, do not forget to clear the app cache by running these commands.

php artisan cache:clear
php artisan view:clear
php artisan config:cache

it should fix it.

Also consider updating your .env file to match new environment variables.

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

2 Comments

Can you give more detail about updating .env file for environment variable? btw, clearing the app cache worked, thanks!
When deploying a laravel app from dev environement to production environement you should update constants in .env file at the root of the project. For ex. APP_URL=http://localhost in dev should be APP_URL=https://domain.tld in production environment. you should always exclude the file when pushing to another environment. and after each edit of the .env file you also need to run php artisan config:cache or laravel will not recognize new constants.
20

If any of the answers above do not work. why don't you try modifying the name of config.php project/bootstrap/cache/config.php to another name like config.php.old it worked for me with laravel 5.3

Comments

15

A view should an extension .blade.php.

So your file that has the admin form should have the name admin.blade.php

Note :

If you have the view under any sub directory like somefolder/admin.blade.php

Then you should do like this

return \View::make('somefolder/admin');

Learn more about templating here :)

Comments

3

I had the same problem because I had a backslash \, the solution was change it to slash:

return \View::make('folder/admin');

Comments

2

You don't want to reference your views beginning with a slash.

This:

return \View::make('/admin');

Should look like:

return \View::make('admin');

Comments

0

Please check first that folder is under views folder i.e resources/views/foldername/filename

then you can test

Route::get('route_name', function () {
    return view('foldername.file_name');
});

Comments

0

Laravel has an authentication skeleton generator which might have been previously used prior to your current state in your project. I had this error and I was coming from a git clone that had Laravel extra's omitted from sharing good practices.

By reissuing the command

php artisan make:auth

https://laravel.com/docs/5.6/authentication#introduction

Comments

0

I just remove '.blade.php' at the end of the path.

Comments

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.