illuminate-container

How to create Illuminate/Support/Facade/App facade for standalone Illuminate IoC Container

こ雲淡風輕ζ 提交于 2019-12-05 06:43:31
In my standalone (without Laravel) project i want to use Illuminate IoC container. Also i would like to access the app container through App facade provided by illuminate/support component. I installed both components (v5.0.28). Here is my (simplified) code: function setup_App(){ $container = new Illuminate\Container\Container(); Illuminate\Support\Facades\Facade::setFacadeApplication($container); class_alias('Illuminate\Support\Facades\App', 'App'); } setup_App(); App::bind('w', 'Widget'); $widget = App::make('w'); Unfortunately, trying to bind something results in: Fatal error: Call to

How to use Illuminate Database Query Builder & Eloquent in other framework with PHP 5.3.x

淺唱寂寞╮ 提交于 2019-12-05 05:02:04
问题 I did a couple of projects with Laravel in the past but now I need something very light for a project and went to use Slim, it works great for what I need and I want the great Eloquent ORM and Query Builder of Laravel, can't go without it now :) Now I manage to get it all working with composer, using the information that Taylor displayed on his GitHub, copied his piece of code use Illuminate\Database\Capsule\Manager as Capsule; $capsule = new Capsule; $capsule->addConnection([ 'driver' =>

How to use Illuminate Database Query Builder & Eloquent in other framework with PHP 5.3.x

可紊 提交于 2019-12-03 20:26:40
I did a couple of projects with Laravel in the past but now I need something very light for a project and went to use Slim, it works great for what I need and I want the great Eloquent ORM and Query Builder of Laravel, can't go without it now :) Now I manage to get it all working with composer, using the information that Taylor displayed on his GitHub, copied his piece of code use Illuminate\Database\Capsule\Manager as Capsule; $capsule = new Capsule; $capsule->addConnection([ 'driver' => 'mysql', 'host' => 'localhost', 'database' => '', 'username' => '', 'password' => '', 'charset' => 'utf8',

Eloquent error: A facade root has not been set

那年仲夏 提交于 2019-11-28 21:07:59
I have been using Eloquent as a standalone package in Slim Framework 2 successfully. But now that I want to make use of Illuminate\Support\Facades\DB since I need to show some statistics by getting the info from 2 tables and using a Left Join and a Counter from the database like this: use Illuminate\Support\Facades\DB; $projectsbyarea = DB::table('projects AS p') ->select(DB::raw('DISTINCT a.area, COUNT(a.area) AS Quantity')) ->leftJoin('areas AS a','p.area_id','=','a.id') ->where('p.status','in_process') ->where('a.area','<>','NULL') ->orderBy('p.area_id'); I get the following error: Type:

Eloquent error: A facade root has not been set

孤者浪人 提交于 2019-11-26 20:07:30
问题 I have been using Eloquent as a standalone package in Slim Framework 2 successfully. But now that I want to make use of Illuminate\Support\Facades\DB since I need to show some statistics by getting the info from 2 tables and using a Left Join and a Counter from the database like this: use Illuminate\Support\Facades\DB; $projectsbyarea = DB::table('projects AS p') ->select(DB::raw('DISTINCT a.area, COUNT(a.area) AS Quantity')) ->leftJoin('areas AS a','p.area_id','=','a.id') ->where('p.status',