Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
70082508
Commit
70082508
authored
Jan 27, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve bundle configuration and registration.
parent
300ab50a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
5 deletions
+20
-5
routes.php
application/routes.php
+1
-0
bundles.php
bundles/bundles.php
+4
-0
bundle.php
laravel/bundle.php
+11
-3
core.php
laravel/core.php
+4
-2
No files found.
application/routes.php
View file @
70082508
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
Router
::
register
(
array
(
'GET /'
,
'GET /home'
),
function
()
Router
::
register
(
array
(
'GET /'
,
'GET /home'
),
function
()
{
{
var_dump
(
Bundle
::
$bundles
);
return
View
::
make
(
'home.index'
);
return
View
::
make
(
'home.index'
);
});
});
...
...
bundles/bundles.php
View file @
70082508
...
@@ -27,6 +27,10 @@
...
@@ -27,6 +27,10 @@
| Now the bundle will be recognized by Laravel and will be able
| Now the bundle will be recognized by Laravel and will be able
| to respond to requests beginning with "admin"!
| to respond to requests beginning with "admin"!
|
|
| Have a bundle that lives in the root of the bundle directory
| and doesn't respond to any requests? Just add the bundle
| name to the array and we'll take care of the rest.
|
*/
*/
return
array
();
return
array
();
\ No newline at end of file
laravel/bundle.php
View file @
70082508
...
@@ -35,14 +35,22 @@ class Bundle {
...
@@ -35,14 +35,22 @@ class Bundle {
{
{
$defaults
=
array
(
'handles'
=>
null
,
'auto'
=>
false
);
$defaults
=
array
(
'handles'
=>
null
,
'auto'
=>
false
);
// If the given config is actually a string, we will assume it is a location
// and convert it to an array so that the developer may conveniently add
// bundles to the configuration without making an array for each one.
if
(
is_string
(
$config
))
{
$config
=
array
(
'location'
=>
$config
);
}
if
(
!
isset
(
$config
[
'location'
]))
if
(
!
isset
(
$config
[
'location'
]))
{
{
throw
new
\Exception
(
"Location not set for bundle [
$bundle
]"
);
throw
new
\Exception
(
"Location not set for bundle [
$bundle
]"
);
}
}
// We will trim the trailing slash from the location and add it back so
we don't
// We will trim the trailing slash from the location and add it back so
//
have to worry about the developer adding or not adding it to the location
//
we don't have to worry about the developer adding or not adding it
//
path for the bundle. This makes sure it is always ther
e.
//
to the location path for the bundl
e.
$config
[
'location'
]
=
BUNDLE_PATH
.
rtrim
(
$config
[
'location'
],
DS
)
.
DS
;
$config
[
'location'
]
=
BUNDLE_PATH
.
rtrim
(
$config
[
'location'
],
DS
)
.
DS
;
static
::
$bundles
[
$bundle
]
=
array_merge
(
$defaults
,
$config
);
static
::
$bundles
[
$bundle
]
=
array_merge
(
$defaults
,
$config
);
...
...
laravel/core.php
View file @
70082508
...
@@ -47,7 +47,9 @@ Autoloader::$aliases = Config::get('application.aliases');
...
@@ -47,7 +47,9 @@ Autoloader::$aliases = Config::get('application.aliases');
*/
*/
$bundles
=
require
BUNDLE_PATH
.
'bundles'
.
EXT
;
$bundles
=
require
BUNDLE_PATH
.
'bundles'
.
EXT
;
foreach
(
$bundles
as
$bundle
=>
$
config
)
foreach
(
$bundles
as
$bundle
=>
$
value
)
{
{
Bundle
::
register
(
$bundle
,
$config
);
if
(
is_numeric
(
$bundle
))
$bundle
=
$value
;
Bundle
::
register
(
$bundle
,
$value
);
}
}
\ No newline at end of file
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