Skip to content

Instantly share code, notes, and snippets.

@jeffochoa

jeffochoa/1.php Secret

Last active June 3, 2019 01:19
Show Gist options
  • Save jeffochoa/d67179af2b06e2b90c0b543fc8c0db72 to your computer and use it in GitHub Desktop.
Save jeffochoa/d67179af2b06e2b90c0b543fc8c0db72 to your computer and use it in GitHub Desktop.
Simple Blade components for your Laravel applications
<?php
class MenuComponent
{
public function __toString()
{
// build your $menu data
return view('partials.menu', ['menu' => $menu])->render();
}
}
<?php
class MenuComponent
{
public static function make()
{
return new static();
}
public function __toString()
{
// build your $menu data
return view('partials.menu', ['menu' => $menu])->render();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment