Skip to content

Commit

Permalink
Refactor bootstrappers.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Mar 3, 2019
1 parent 0f3aac9 commit 8e88331
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/Bootstrap/LoadExpresso.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public function bootstrap(Application $app)
*/
protected function addBladeExtensions(Application $app)
{
$blade = $app->make('view')->getEngineResolver()->resolve('blade')->getCompiler();
$blade = $app->make('blade.compiler');

$blade->directive('decorator', function ($expression) {
return "<?php echo app('orchestra.decorator')->render({$expression}); ?>";
return "<?php echo \app('orchestra.decorator')->render({$expression}); ?>";
});

$blade->directive('placeholder', function ($expression) {
Expand All @@ -43,15 +43,15 @@ protected function addBladeExtensions(Application $app)
});

$blade->directive('get_meta', function ($expression) {
return "<?php echo get_meta({$expression}); ?>";
return "<?php echo \get_meta({$expression}); ?>";
});

$blade->directive('set_meta', function ($expression) {
return "<?php set_meta({$expression}); ?>";
return "<?php \set_meta({$expression}); ?>";
});

$blade->directive('title', function ($expression) {
return "<?php echo app('html')->title({$expression}); ?>";
return "<?php echo \app('html')->title({$expression}); ?>";
});

$blade->extend(function ($view) {
Expand Down
6 changes: 3 additions & 3 deletions src/Bootstrap/LoadUserMetaData.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class LoadUserMetaData
public function bootstrap(Application $app)
{
$app->make('orchestra.memory')->extend('user', function ($app, $name) {
$handler = new UserRepository($name, [], $app);

return new UserProvider($handler);
return new UserProvider(
new UserRepository($name, [], $app)
);
});
}
}
3 changes: 2 additions & 1 deletion src/Bootstrap/NotifyIfSafeMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Orchestra\Foundation\Bootstrap;

use Orchestra\Support\Facades\Messages;
use Orchestra\Contracts\Messages\MessageBag;
use Illuminate\Contracts\Foundation\Application;

Expand All @@ -17,7 +18,7 @@ class NotifyIfSafeMode
public function bootstrap(Application $app)
{
if ($app->make('orchestra.extension.status')->is('safe')) {
$app->make('orchestra.messages')->extend(function (MessageBag $messages) {
Messages::extend(function (MessageBag $messages) {
$messages->add('info', \trans('orchestra/foundation::response.safe-mode'));
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/Bootstrap/UserAccessPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ protected function attachAccessPolicyEvents(Application $app)

// Orchestra Platform should be able to determine admin and member roles
// dynamically.
Role::setDefaultRoles($app->make('config')->get('orchestra/foundation::roles'));
Role::setDefaultRoles(\config('orchestra/foundation::roles'));
}
}
2 changes: 1 addition & 1 deletion tests/Feature/Bootstrap/LoadExpressoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function it_can_register_decorator()
$compiler = $this->app['view']->getEngineResolver()->resolve('blade')->getCompiler();

$this->assertEquals(
'<?php echo app(\'orchestra.decorator\')->render("foo"); ?>', $compiler->compileString('@decorator("foo")')
'<?php echo \app(\'orchestra.decorator\')->render("foo"); ?>', $compiler->compileString('@decorator("foo")')
);
}

Expand Down

0 comments on commit 8e88331

Please sign in to comment.