Skip to content

Commit

Permalink
Merge pull request #27 from talyssonoc/fix_provider
Browse files Browse the repository at this point in the history
Fix provider that stopped working
  • Loading branch information
talyssonoc committed Jun 11, 2015
2 parents 0bf6c4c + 0d96753 commit 2e0f65a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/ReactServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php namespace React;

use Blade;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Cache;

Expand All @@ -12,8 +12,8 @@ class ReactServiceProvider extends ServiceProvider {

public function boot() {

Blade::extend(function($view, $compiler) {
$pattern = $compiler->createMatcher('react_component');
Blade::extend(function($view) {
$pattern = $this->createMatcher('react_component');

return preg_replace($pattern, '<?php echo React::render$2; ?>', $view);
});
Expand Down Expand Up @@ -56,9 +56,12 @@ public function register() {
});
}

protected function createMatcher($function) {
return '/(?<!\w)(\s*)@' . $function . '(\s*\(.*\))/';
}

public function provides() {
return ['React'];
}


}

0 comments on commit 2e0f65a

Please sign in to comment.