Skip to content

Instantly share code, notes, and snippets.

@jdavidbakr
Created May 22, 2015 17:18
Show Gist options
  • Save jdavidbakr/0115b812b7c2eaf940b4 to your computer and use it in GitHub Desktop.
Save jdavidbakr/0115b812b7c2eaf940b4 to your computer and use it in GitHub Desktop.
Snippet: Laravel View Composer
<snippet>
<content><![CDATA[
<?php
namespace ${1:App\Http\ViewComposers};
use View;
use Illuminate\Support\ServiceProvider;
class ${2:My}ViewComposer extends ServiceProvider {
public function boot() {
View::composer('${3:*}', function(\$view) {
\$view->with('${4:variable}', '${5:value}');
});
}
public function register() {
}
}
?>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>view</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment