continued refactoring of view classes.
This commit is contained in:
parent
15cde60794
commit
8229891d26
|
@ -37,9 +37,9 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'GET /' => function($application)
|
'GET /' => function($laravel)
|
||||||
{
|
{
|
||||||
return $application->view->make('home.index');
|
return $laravel->view->make('home.index');
|
||||||
},
|
},
|
||||||
|
|
||||||
);
|
);
|
|
@ -81,7 +81,7 @@
|
||||||
|
|
||||||
<h2><?php echo $apology; ?></h2>
|
<h2><?php echo $apology; ?></h2>
|
||||||
|
|
||||||
<p>We couldn't find the resource you requested. Would you like go to our <a href="<?php echo Laravel\Config::get('application.url'); ?>">home page</a> instead?</p>
|
<p>We couldn't find the resource you requested. Would you like go to our <a href="<?php echo $homepage; ?>">home page</a> instead?</p>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
class Download extends Response {
|
class Download extends Response {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The file manager instance.
|
||||||
|
*
|
||||||
|
* @var File
|
||||||
|
*/
|
||||||
|
protected $file;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new download generator instance.
|
* Create a new download generator instance.
|
||||||
*
|
*
|
||||||
|
|
|
@ -57,6 +57,8 @@ public function view($view, $data = array())
|
||||||
*/
|
*/
|
||||||
public function error($code, $data = array())
|
public function error($code, $data = array())
|
||||||
{
|
{
|
||||||
|
$data['homepage'] = IoC::resolve('laravel.config')->get('application.url');
|
||||||
|
|
||||||
return new Response($this->view->make('error/'.$code, $data), $code);
|
return new Response($this->view->make('error/'.$code, $data), $code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,4 +223,14 @@ public function status($status)
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Magic Method for passing undefined static methods to the Response_Factory instance
|
||||||
|
* registered in the application IoC container. This provides easy access to the
|
||||||
|
* response functions while still maintaining testability within the classes.
|
||||||
|
*/
|
||||||
|
public static function __callStatic($method, $parameters)
|
||||||
|
{
|
||||||
|
return call_user_func_array(array(IoC::container()->resolve('laravel.response'), $method), $parameters);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,6 +8,13 @@
|
||||||
*/
|
*/
|
||||||
class View_Composer {
|
class View_Composer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The view composers.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $composers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new view composer instance.
|
* Create a new view composer instance.
|
||||||
*
|
*
|
||||||
|
@ -59,6 +66,20 @@ public function compose(View $view)
|
||||||
*/
|
*/
|
||||||
class View_Factory {
|
class View_Factory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The directory containing the views.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The view composer instance.
|
||||||
|
*
|
||||||
|
* @var View_Composer
|
||||||
|
*/
|
||||||
|
protected $composer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new view factory instance.
|
* Create a new view factory instance.
|
||||||
*
|
*
|
||||||
|
@ -114,14 +135,6 @@ protected function path($view)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic Method for handling the dynamic creation of named views.
|
* Magic Method for handling the dynamic creation of named views.
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* // Create an instance of the "login" named view
|
|
||||||
* $view = View::of_login();
|
|
||||||
*
|
|
||||||
* // Create an instance of the "login" named view and bind data to the view
|
|
||||||
* $view = View::of_login(array('name' => 'Fred'));
|
|
||||||
* </code>
|
|
||||||
*/
|
*/
|
||||||
public function __call($method, $parameters)
|
public function __call($method, $parameters)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue