Skip to content

Commit

Permalink
Simplify package.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Nov 5, 2014
1 parent fbde958 commit 1523656
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
34 changes: 17 additions & 17 deletions src/Installation/Installation.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct($app)
*/
public function bootInstallerFiles()
{
$paths = array('path.database', 'path');
$paths = ['path.database', 'path'];

foreach ($paths as $path) {
$file = rtrim($this->app[$path], '/').'/orchestra/installer.php';
Expand Down Expand Up @@ -64,12 +64,12 @@ public function migrate()
public function createAdmin($input, $allowMultiple = true)
{
// Grab input fields and define the rules for user validations.
$rules = array(
'email' => array('required', 'email'),
'password' => array('required'),
'fullname' => array('required'),
'site_name' => array('required'),
);
$rules = [
'email' => ['required', 'email'],
'password' => ['required'],
'fullname' => ['required'],
'site_name' => ['required'],
];

$validation = $this->app['validator']->make($input, $rules);

Expand Down Expand Up @@ -110,26 +110,26 @@ protected function runApplicationSetup($input)
// configuration.
$user = $this->createUser($input);
$memory = $this->app['orchestra.memory']->make();
$actions = array('Manage Orchestra', 'Manage Users');
$actions = ['Manage Orchestra', 'Manage Users'];
$admin = $this->app['config']->get('orchestra/foundation::roles.admin', 1);
$roles = $this->app['orchestra.role']->newQuery()->lists('name', 'id');
$theme = array(
$theme = [
'frontend' => 'default',
'backend' => 'default',
);
];

// Attach Administrator role to the newly created administrator.
$user->roles()->sync(array($admin));
$user->roles()->sync([$admin]);

// Add some basic configuration for Orchestra Platform, including
// email configuration.
$memory->put('site.name', $input['site_name']);
$memory->put('site.theme', $theme);
$memory->put('email', $this->app['config']->get('mail'));
$memory->put('email.from', array(
$memory->put('email.from', [
'name' => $input['site_name'],
'address' => $input['email']
));
]);

// We should also create a basic ACL for Orchestra Platform, since
// the basic roles is create using Fluent Query Builder we need
Expand All @@ -141,7 +141,7 @@ protected function runApplicationSetup($input)
$acl->roles()->attach(array_values($roles));
$acl->allow($roles[$admin], $actions);

$this->app['events']->fire('orchestra.install: acl', array($acl));
$this->app['events']->fire('orchestra.install: acl', [$acl]);
}

/**
Expand All @@ -155,14 +155,14 @@ protected function createUser($input)
User::unguard();
$user = $this->app['orchestra.user']->newInstance();

$user->fill(array(
$user->fill([
'email' => $input['email'],
'password' => $input['password'],
'fullname' => $input['fullname'],
'status' => 0,
));
]);

$this->app['events']->fire('orchestra.install: user', array($user, $input));
$this->app['events']->fire('orchestra.install: user', [$user, $input]);

$user->save();

Expand Down
4 changes: 2 additions & 2 deletions src/Installation/InstallerServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Orchestra\Installation;

use Illuminate\Support\ServiceProvider;
use Orchestra\Support\Providers\ServiceProvider;

class InstallerServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -29,7 +29,7 @@ public function boot()
{
$path = realpath(__DIR__.'/../');

$this->package('orchestra/installer', 'orchestra/installer', $path);
$this->addViewComponent('orchestra/installer', 'orchestra/installer', $path.'/view');

require "{$path}/routes.php";
}
Expand Down
12 changes: 6 additions & 6 deletions src/Installation/Processor/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ public function index($listener)
// If the auth status is false, installation shouldn't be possible.
(true === $authentication) || $installable = false;

$data = array(
$data = [
'database' => $database,
'auth' => $auth,
'authentication' => $authentication,
'installable' => $installable,
'checklist' => $requirement->getChecklist(),
);
];

return $listener->indexSucceed($data);
}
Expand All @@ -85,9 +85,9 @@ public function prepare($listener)
*/
public function create($listener)
{
return $listener->createSucceed(array(
return $listener->createSucceed([
'siteName' => 'Orchestra Platform',
));
]);
}

/**
Expand Down Expand Up @@ -125,7 +125,7 @@ public function done($listener)
protected function getRunningConfiguration()
{
$driver = Config::get('database.default', 'mysql');
$database = Config::get("database.connections.{$driver}", array());
$database = Config::get("database.connections.{$driver}", []);
$auth = Config::get('auth');

// For security, we shouldn't expose database connection to anyone,
Expand All @@ -136,7 +136,7 @@ protected function getRunningConfiguration()

$authentication = $this->isAuthenticationInstallable($auth);

return array($database, $auth, $authentication);
return [$database, $auth, $authentication];
}

/**
Expand Down

0 comments on commit 1523656

Please sign in to comment.