Skip to content

Instantly share code, notes, and snippets.

@mrsimonbennett
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrsimonbennett/0cfb1dcac63df4a41cb5 to your computer and use it in GitHub Desktop.
Save mrsimonbennett/0cfb1dcac63df4a41cb5 to your computer and use it in GitHub Desktop.
Compose
<?php
namespace FullRent\Http\Composers;
use Illuminate\Contracts\View\View;
/**
* Interface Compose
* @package FullRent\Http\Composers
* @author Simon Bennett <simon@bennett.im>
*/
interface Compose
{
/**
* @param View $view
* @return void
*/
public function compose(View $view);
}
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
/** @var Factory $view */
$view = $this->app->make('Illuminate\Contracts\View\Factory');
$view->composer('dashboard.settings.me.details', SettingsMeDetails::class);
}
/**
* @return \Illuminate\Contracts\View\View
*/
public function getDetails()
{
return $this->view->make('dashboard.settings.me.details');
}
final class SettingsMeDetails implements Compose
{
/**
* @var Guard
*/
private $guard;
/**
* @param Guard $guard
*/
public function __construct(Guard $guard)
{
$this->guard = $guard;
}
/**
* @param View $view
* @return void
*/
public function compose(View $view)
{
$view->with('title','Update User Details');
$view->with('user',$this->guard->user());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment