Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
893bb838
Commit
893bb838
authored
Sep 01, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added application access to composers.
parent
5e40e296
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
14 deletions
+28
-14
application/composers.php
+1
-1
laravel/config/container.php
+8
-2
laravel/view.php
+19
-11
No files found.
application/composers.php
View file @
893bb838
...
...
@@ -39,7 +39,7 @@ return array(
|
*/
'home.index'
=>
array
(
'name'
=>
'home'
,
function
(
$view
)
'home.index'
=>
array
(
'name'
=>
'home'
,
function
(
$
laravel
,
$
view
)
{
//
}),
...
...
laravel/config/container.php
View file @
893bb838
...
...
@@ -158,11 +158,17 @@ return array(
}),
'laravel.view'
=>
array
(
'singleton'
=>
true
,
'resolver'
=>
function
()
'laravel.view'
=>
array
(
'singleton'
=>
true
,
'resolver'
=>
function
(
$container
)
{
require_once
SYS_PATH
.
'view'
.
EXT
;
return
new
View_Factory
(
VIEW_PATH
,
new
View_Composer
(
require
APP_PATH
.
'composers'
.
EXT
));
return
new
View_Factory
(
$container
->
resolve
(
'laravel.view.composer'
),
VIEW_PATH
);
}),
'laravel.view.composer'
=>
array
(
'resolver'
=>
function
(
$container
)
{
return
new
View_Composer
(
$container
->
resolve
(
'laravel.application'
),
require
APP_PATH
.
'composers'
.
EXT
);
}),
/*
...
...
laravel/view.php
View file @
893bb838
...
...
@@ -9,6 +9,13 @@
class
View_Composer
{
/**
* The application instance.
*
* @var Application
*/
protected
$application
;
/**
* The view composers.
*
* @var array
...
...
@@ -21,8 +28,9 @@ class View_Composer {
* @param array $composers
* @return void
*/
public
function
__construct
(
$composers
)
public
function
__construct
(
Application
$application
,
$composers
)
{
$this
->
application
=
$application
;
$this
->
composers
=
$composers
;
}
...
...
@@ -52,7 +60,7 @@ class View_Composer {
{
foreach
((
array
)
$this
->
composers
[
$view
->
view
]
as
$key
=>
$value
)
{
if
(
$value
instanceof
\Closure
)
return
call_user_func
(
$value
,
$view
);
if
(
$value
instanceof
\Closure
)
return
call_user_func
(
$value
,
$
this
->
application
,
$
view
);
}
}
}
...
...
@@ -67,30 +75,30 @@ class View_Composer {
class
View_Factory
{
/**
* The
directory containing the views
.
* The
view composer instance
.
*
* @var
string
* @var
View_Composer
*/
protected
$
path
;
protected
$
composer
;
/**
* The
view composer instance
.
* The
directory containing the views
.
*
* @var
View_Composer
* @var
string
*/
protected
$
composer
;
protected
$
path
;
/**
* Create a new view factory instance.
*
* @param
array $composers
* @param
View_Composer $composer
* @param string $path
* @return void
*/
public
function
__construct
(
$path
,
View_Composer
$composer
)
public
function
__construct
(
View_Composer
$composer
,
$path
)
{
$this
->
path
=
$path
;
$this
->
composer
=
$composer
;
$this
->
path
=
$path
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment