Last active
August 29, 2015 14:16
-
-
Save mrsimonbennett/0cfb1dcac63df4a41cb5 to your computer and use it in GitHub Desktop.
Compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace FullRent\Http\Composers; | |
use Illuminate\Contracts\View\View; | |
/** | |
* Interface Compose | |
* @package FullRent\Http\Composers | |
* @author Simon Bennett <[email protected]> | |
*/ | |
interface Compose | |
{ | |
/** | |
* @param View $view | |
* @return void | |
*/ | |
public function compose(View $view); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @return \Illuminate\Contracts\View\View | |
*/ | |
public function getDetails() | |
{ | |
return $this->view->make('dashboard.settings.me.details'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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