diff --git a/app/console/Welcome.php b/app/console/Welcome.php new file mode 100644 index 0000000..c353de1 --- /dev/null +++ b/app/console/Welcome.php @@ -0,0 +1,21 @@ +add('system', __DIR__); +$loader->add('app', __DIR__); + +/** + * @Let us eat a capsule to use eloquent + */ + +$capsule = new Capsule; + +$capsule->addConnection([ + 'driver' => 'mysql', + 'host' => DB_HOST, + 'database' => DB_NAME, + 'username' => DB_USER, + 'password' => DB_PASS, + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', +]); + +// Set the event dispatcher used by Eloquent models... (optional) +use Illuminate\Events\Dispatcher; +use Illuminate\Container\Container; +$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(); //eloquent boot done + +// Run the command +use system\console\Command; + +$command = new Command($argv); diff --git a/system/console/Command.php b/system/console/Command.php new file mode 100644 index 0000000..ab7f985 --- /dev/null +++ b/system/console/Command.php @@ -0,0 +1,42 @@ +run($className,$methodName, $argv); + }catch(Exception $e){ + + } + } + + public function run($className, $methodName, $args){ + + $objectName = '\app\console\\'.$className; + + if(method_exists($objectName, $methodName)) { + + $object = new $objectName; + $object->{$methodName}($args); + + } + else{ + echo "Method not found"; + } + } +} \ No newline at end of file