Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
Platform
Commits
6a34661b
Unverified
Commit
6a34661b
authored
May 03, 2018
by
Nicolas Widart
Committed by
GitHub
May 03, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #516 from tranfuga25s/AddSettingsDirective
Add settings directives
parents
ca13b958
aa191d04
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
SettingDirective.php
Modules/Setting/Blade/SettingDirective.php
+15
-0
SettingServiceProvider.php
Modules/Setting/Providers/SettingServiceProvider.php
+9
-0
No files found.
Modules/Setting/Blade/SettingDirective.php
View file @
6a34661b
...
...
@@ -27,6 +27,21 @@ final class SettingDirective
return
setting
(
$this
->
settingName
,
$this
->
locale
,
$this
->
default
);
}
/**
* Check if a setting is set and is not empty
* @param array $arguments
* @return boolean
*/
public
function
has
(
$arguments
)
{
$value
=
$this
->
show
(
$arguments
);
if
(
empty
(
$value
))
{
return
false
;
}
return
true
;
}
/**
* @param array $arguments
*/
...
...
Modules/Setting/Providers/SettingServiceProvider.php
View file @
6a34661b
...
...
@@ -94,8 +94,17 @@ class SettingServiceProvider extends ServiceProvider
if
(
app
()
->
environment
()
===
'testing'
)
{
return
;
}
$this
->
app
[
'blade.compiler'
]
->
directive
(
'setting'
,
function
(
$value
)
{
return
"<?php echo SettingDirective::show([
$value
]); ?>"
;
});
$this
->
app
[
'blade.compiler'
]
->
directive
(
'hasSetting'
,
function
(
$value
)
{
return
"<?php if (SettingDirective::has([
$value
])) : ?>"
;
});
$this
->
app
[
'blade.compiler'
]
->
directive
(
'endHasSetting'
,
function
()
{
return
"<?php endif; ?>"
;
});
}
}
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