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
ba8d0a92
Commit
ba8d0a92
authored
Nov 28, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
7f79ef73
'
* commit '
7f79ef73
': Squashed 'Modules/Core/' changes from e713728..5720517
parents
a75693f1
7f79ef73
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
2 deletions
+55
-2
LocaleComposer.php
Modules/Core/Composers/LocaleComposer.php
+12
-0
BasePublicController.php
Modules/Core/Http/Controllers/BasePublicController.php
+2
-2
BaseRepository.php
Modules/Core/Repositories/BaseRepository.php
+14
-0
EloquentBaseRepository.php
...les/Core/Repositories/Eloquent/EloquentBaseRepository.php
+26
-0
composers.php
Modules/Core/composers.php
+1
-0
No files found.
Modules/Core/Composers/LocaleComposer.php
0 → 100644
View file @
ba8d0a92
<?php
namespace
Modules\Core\Composers
;
use
Illuminate\Contracts\View\View
;
use
Illuminate\Support\Facades\App
;
class
LocaleComposer
{
public
function
compose
(
View
$view
)
{
$view
->
with
(
'currentLocale'
,
App
::
getLocale
());
}
}
Modules/Core/Http/Controllers/BasePublicController.php
View file @
ba8d0a92
...
...
@@ -13,9 +13,9 @@ abstract class BasePublicController
*/
private
$setting
;
public
function
__construct
(
Setting
$setting
)
public
function
__construct
()
{
$this
->
setting
=
$setting
;
$this
->
setting
=
app
(
'setting.settings'
)
;
$this
->
theme
=
$this
->
setting
->
get
(
'core::template'
);
}
}
Modules/Core/Repositories/BaseRepository.php
View file @
ba8d0a92
...
...
@@ -39,4 +39,18 @@ interface BaseRepository
* @return mixed
*/
public
function
destroy
(
$model
);
/**
* Return resources translated in the given language
* @param $lang
* @return object
*/
public
function
allTranslatedIn
(
$lang
);
/**
* Find a resource by the given slug
* @param int $slug
* @return object
*/
public
function
findBySlug
(
$slug
);
}
Modules/Core/Repositories/Eloquent/EloquentBaseRepository.php
View file @
ba8d0a92
...
...
@@ -60,4 +60,30 @@ abstract class EloquentBaseRepository implements BaseRepository
{
return
$model
->
delete
();
}
/**
* Return all categories in the given language
* @param $lang
* @return mixed
*/
public
function
allTranslatedIn
(
$lang
)
{
return
$this
->
model
->
whereHas
(
'translations'
,
function
(
$q
)
use
(
$lang
)
{
$q
->
where
(
'locale'
,
"
$lang
"
);
})
->
orderBy
(
'created_at'
,
'DESC'
)
->
get
();
}
/**
* Find a resource by the given slug
* @param int $slug
* @return object
*/
public
function
findBySlug
(
$slug
)
{
return
$this
->
model
->
whereHas
(
'translations'
,
function
(
$q
)
use
(
$slug
)
{
$q
->
where
(
'slug'
,
"
$slug
"
);
})
->
first
();
}
}
Modules/Core/composers.php
View file @
ba8d0a92
...
...
@@ -3,3 +3,4 @@
View
::
creator
(
'core::partials.sidebar-nav'
,
'Modules\Core\Composers\SidebarViewCreator'
);
View
::
composer
(
'core::layouts.master'
,
'Modules\Core\Composers\MasterViewComposer'
);
View
::
composer
(
'core::fields.select-theme'
,
'Modules\Core\Composers\ThemeComposer'
);
View
::
composer
(
'*'
,
'Modules\Core\Composers\LocaleComposer'
);
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