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
f7b1a72f
Commit
f7b1a72f
authored
Apr 10, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added unless structure to blade.
parent
fda19731
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
0 deletions
+40
-0
blade.php
laravel/blade.php
+26
-0
changes.md
laravel/documentation/changes.md
+1
-0
templating.md
laravel/documentation/views/templating.md
+13
-0
No files found.
laravel/blade.php
View file @
f7b1a72f
...
@@ -16,6 +16,8 @@ class Blade {
...
@@ -16,6 +16,8 @@ class Blade {
'structure_openings'
,
'structure_openings'
,
'structure_closings'
,
'structure_closings'
,
'else'
,
'else'
,
'unless'
,
'endunless'
,
'includes'
,
'includes'
,
'render_each'
,
'render_each'
,
'render'
,
'render'
,
...
@@ -254,6 +256,30 @@ class Blade {
...
@@ -254,6 +256,30 @@ class Blade {
return
preg_replace
(
'/(\s*)@(else)(\s*)/'
,
'$1<?php $2: ?>$3'
,
$value
);
return
preg_replace
(
'/(\s*)@(else)(\s*)/'
,
'$1<?php $2: ?>$3'
,
$value
);
}
}
/**
* Rewrites Blade "unless" statements into valid PHP.
*
* @param string $value
* @return string
*/
protected
static
function
compile_unless
(
$value
)
{
$pattern
=
'/(\s*)@unless(\s*\(.*\))/'
;
return
preg_replace
(
$pattern
,
'$1<?php if( ! ($2)): ?>'
,
$value
);
}
/**
* Rewrites Blade "unless" endings into valid PHP.
*
* @param string $value
* @return string
*/
protected
static
function
compile_endunless
(
$value
)
{
return
str_replace
(
'@endunless'
,
'<?php endif; ?>'
,
$value
);
}
/**
/**
* Rewrites Blade @include statements into valid PHP.
* Rewrites Blade @include statements into valid PHP.
*
*
...
...
laravel/documentation/changes.md
View file @
f7b1a72f
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
-
[
Added `$hidden` static variable to the base Eloquent model
](
/docs/database/eloquent#to-array
)
.
-
[
Added `$hidden` static variable to the base Eloquent model
](
/docs/database/eloquent#to-array
)
.
-
[
Added `sync` method to has\_many\_and\_belongs\_to Eloquent relationship
](
/docs/database/eloquent#sync-method
)
.
-
[
Added `sync` method to has\_many\_and\_belongs\_to Eloquent relationship
](
/docs/database/eloquent#sync-method
)
.
-
[
Added `save` method to has\_many Eloquent relationship
](
/docs/database/eloquent#has-many-save
)
.
-
[
Added `save` method to has\_many Eloquent relationship
](
/docs/database/eloquent#has-many-save
)
.
-
[
Added `unless` structure to Blade template engine
](
/docs/views/templating#blade-unless
)
.
-
Migrated to the Symfony HttpFoundation component for core request / response handling.
-
Migrated to the Symfony HttpFoundation component for core request / response handling.
-
Fixed the passing of strings into the Input::except method.
-
Fixed the passing of strings into the Input::except method.
-
Fixed replacement of optional parameters in URL::transpose method.
-
Fixed replacement of optional parameters in URL::transpose method.
...
...
laravel/documentation/views/templating.md
View file @
f7b1a72f
...
@@ -105,6 +105,19 @@ Blade makes writing your views pure bliss. To create a blade view, simply name y
...
@@ -105,6 +105,19 @@ Blade makes writing your views pure bliss. To create a blade view, simply name y
There are not posts in the array!
There are not posts in the array!
@endforelse
@endforelse
<a
name=
"blade-unless"
></a>
#### The "unless" control structure:
@unless(Auth::check())
{{ HTML::link_to_route('login', 'Login'); }}
@endunless
// Equivalent...
<?php if ( ! Auth::check()): ?>
...
<?php endif; ?>
<a
name=
"blade-layouts"
></a>
<a
name=
"blade-layouts"
></a>
## Blade Layouts
## Blade Layouts
...
...
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