public function run($arguments) { if (empty($arguments) || count($arguments) < 5) { die("Error: Please enter first name, last name, username, email address and password\n"); } Command::run(array('bundle:publish', 'dojo')); $role = !isset($arguments[5]) ? 'admin' : $arguments[5]; $data = array('name' => $arguments[0] . ' ' . $arguments[1], 'username' => $arguments[2], 'email' => $arguments[3], 'password' => Hash::make($arguments[4]), 'role' => $role); $user = User::create($data); echo $user ? 'Admin created successfully!' : 'Error creating admin!'; }
/** * Starts the process of installing a bundle as an iBundle. Setting * the second parameter to true activates the ibundle on the fly. * * <code> * $ php artisan ibundle::install bundle [true] * </code> * * @param array $arguments * @return null */ public function install($arguments = array()) { $bundle = array_get($arguments, 0, false); if ($bundle === false or empty($bundle)) { Ibundle_Base_Task::error('Invalid iBundle name.'); } // Laravel do your thing. Command::run(array('bundle:install', $bundle)); // ...start tracking bundle $this->track(array($bundle)); echo PHP_EOL; // Activate bundle on the fly if requested if ($activate = array_get($arguments, 1)) { $this->activate($arguments); } // Installed! echo "Finalizing iBundle [{$bundle}] installation... Done!"; }
* the auto-loader mappings are registered. */ Bundle::start(DEFAULT_BUNDLE); /** * The default database connection may be set by specifying a value * for the "database" CLI option. This allows migrations to be run * conveniently for a test or staging database. */ if (!is_null($database = get_cli_option('db'))) { Config::set('database.default', $database); } /** * We will register all of the Laravel provided tasks inside the IoC * container so they can be resolved by the task class. This allows * us to seamlessly add tasks to the CLI so that the Task class * doesn't have to worry about how to resolve core tasks. */ require path('sys') . 'cli/dependencies' . EXT; /** * We will wrap the command execution in a try / catch block and * simply write out any exception messages we receive to the CLI * for the developer. Note that this only writes out messages * for the CLI exceptions. All others will be not be caught * and will be totally dumped out to the CLI. */ try { Command::run(array_slice($arguments, 1)); } catch (\Exception $e) { echo $e->getMessage(); } echo PHP_EOL;
public function get_action_sample() { \Laravel\CLI\Command::run(array('notify')); }
*/ if (isset($environment)) { Request::set_env($environment); } /* |-------------------------------------------------------------------------- | Set The CLI Options Array |-------------------------------------------------------------------------- | | If the current request is from the Artisan command-line interface, we | will parse the command line arguments and options and set them the | array of options in the $_SERVER global array for convenience. | */ if (defined('STDIN')) { $console = CLI\Command::options($_SERVER['argv']); list($arguments, $options) = $console; $options = array_change_key_case($options, CASE_UPPER); $_SERVER['CLI'] = $options; } /* |-------------------------------------------------------------------------- | Register The Laravel Bundles |-------------------------------------------------------------------------- | | Finally we will register all of the bundles that have been defined for | the application. None of them will be started yet, but will be setup | so that they may be started by the developer at any time. | */ $bundles = (require path('app') . 'bundles' . EXT);
public static function publish($module_slug) { require path('sys') . 'cli' . DS . 'dependencies' . EXT; try { $module_assets_path = path('bundle') . $module_slug . DS . 'public' . DS; if (\File::exists($module_assets_path)) { \Bundle::register($module_slug); $publish_cmd = \Laravel\CLI\Command::run(array('bundle:publish', $module_slug)); \Bundle::disable($module_slug); return true; } return true; } catch (\Exception $e) { Log::error($e->getMessage()); Log::error('Failed to publish assets for module [' . $module_slug . '].'); return false; } }
$database_config = str_replace(array('(:database_connection)', '(:database_user)', '(:database_password)', '(:database_name)'), array(Input::get('database_connection'), Input::get('database_user'), Input::get('database_password'), Input::get('database_name')), $database_config); // Save the changes File::put(path('app') . DS . 'config' . DS . 'database' . EXT, $database_config); ob_start(); if (Input::get('start_domain') == '1') { Command::run(array('migrate:install')); Command::run(array('migrate')); } ob_end_clean(); // TODO: Add user via API return Redirect::to('/'); }); } else { ob_start(); Command::run(array('migrate:install')); Command::run(array('migrate')); ob_end_clean(); return Redirect::to('/'); } } else { Route::get('/', function () { return View::make('layouts.default')->with('meta_title', 'A sexy CMS that knows what it wants')->nest('content', 'home.index'); }); } /* |-------------------------------------------------------------------------- | Application 404 & 500 Error Handlers |-------------------------------------------------------------------------- | | To centralize and simplify 404 handling, Laravel uses an awesome event | system to retrieve the response. Feel free to modify this function to