Skip to content

Commit

Permalink
Add better notification if config isn't published
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyWay committed Feb 6, 2015
1 parent 2d7dcc9 commit fb96d2d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/JavaScriptException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Laracasts\Utilities\JavaScript;

class JavaScriptException extends \Exception {

/**
* The exception message.
*
* @var string
*/
protected $message =
'JavaScript configuration must be published. Use: "php artisan vendor:publish".';
}
4 changes: 4 additions & 0 deletions src/JavascriptServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public function register()
$view = config('javascript.bind_js_vars_to_this_view');
$namespace = config('javascript.js_namespace');

if (is_null($view)) {
throw new JavaScriptException;
}

$binder = new LaravelViewBinder($app['events'], $view);

return new PHPToJavaScriptTransformer($binder, $namespace);
Expand Down

0 comments on commit fb96d2d

Please sign in to comment.