关于在非对象上调用成员函数domain()

I have a question about Laravel 5. After using Form::open, some error occurs:

error : Call to a member function domain() on a non-object

FatalErrorException in UrlGenerator.php line 440:
Call to a member function domain() on a non-object
in UrlGenerator.php line 440
at HandleExceptions->fatalExceptionFromError(array('type' => '1', 'message' => 'Call to a member function domain() on a non-object', 'file' => '/home/nl/Laravel/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php', 'line' => '440')) in HandleExceptions.php line 116
at HandleExceptions->handleShutdown()

This is my LoginCheckController.php:

<?php namespace App\Http\Controllers;

class LoginCheckController extends BaseController {

    public function index()

This is my route:

Route::post('/LoginCheck', 'LoginCheckController@index');

In view I have this:

{!! Form::open(array('action' => 'LoginCheckController@index')) !!}

I also ran composer dump-autoload and php artisan clear-compiled, but I still get the error. Is there something I forgot?

I solved it by:

  1. Re-installing composer with clear version
  2. php artisan make:controller with manual

Try including the namespace in the action:

{!! Form::open(array('action' => 'App\Http\Controllers\LoginCheckController@index')) !!}

http://laravel.io/forum/10-03-2014-laravel-5-call-to-a-member-function-domain-on-a-non-object

First update your laravel framework package, looking at the line you're running behind.

Second, in Laravel 5 everything is lives in the App namespace, your controllers are in App\Http\Controllers\. The routes are working because of the namespace for it being set in the RouteServiceProvider.

Try adding the namespace in your template when using action, or use named routes like this:

Route::post('/LoginCheck', ['uses' => 'LoginCheckController@index', 'as' => 'login.check.index']);

{!! Form::open(['route' => 'login.check.index']) !!}