Reputation: 10097
I've inherited a project that was 'plain' php i.e. it didn't use a Framework or other dependencies. I've been working on integrating Eloquent and Ardent (for self-validating models).
I've installed them using composer and all seems to be working well. I have a folder called Models and I load the classes using a bootstrap type file:
$loader = require 'vendor/autoload.php';
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
use Illuminate\Support\Facades\Facade;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
$capsule = new Capsule;
$capsule->addConnection([
'driver' => 'mysql',
'host' => '127.0.0.1',
'database' => '*********',
'username' => '*********',
'password' => '*********',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
]);
$capsule->setEventDispatcher(new Dispatcher(new Container));
// Make this Capsule instance available globally via static methods... (optional)
$capsule->setAsGlobal();
// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
$capsule->bootEloquent();
// Autoload all the models
spl_autoload_register(function ($class) {
include 'models/' . $class . '.php';
});
LaravelBook\Ardent\Ardent::configureAsExternal(array(
'driver' => 'mysql',
'host' => '127.0.0.1',
'port' => 3306,
'database' => '************',
'username' => '************',
'password' => '************',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci'
), 'en'); //English is the default messages language, may be left empty
However, whenever I try to use Input::all() it causes the following error:
Call to a member function all() on a non-object in /home/loadbay/public_html/beta/php-bin/vendor/illuminate/support/Facades/Facade.php on line 207
I'm assuming it's something to do with Facades and I'm not sure how to get this working. Can someone help me understand how I can use Input::all() please?
Update
Line 207 of Facade.php:
return $instance->$method();
Upvotes: 0
Views: 1474
Reputation: 62338
Instead of using the Input()
facade, you could try just creating the Request
directly:
$request = \Illuminate\Http\Request::capture();
$input = $request->all();
It would be nice to have a Container
to hook all this together, but I don't have that information for you right now.
Upvotes: 2