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
d3b42637
Commit
d3b42637
authored
Oct 15, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a settings edit page. Add setting repositories. Create new migration for transtaled settings
parent
6c3c2a4b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
181 additions
and
9 deletions
+181
-9
SidebarViewComposer.php
Composers/SidebarViewComposer.php
+1
-1
2014_10_14_200250_create_settings_table.php
...se/Migrations/2014_10_14_200250_create_settings_table.php
+0
-3
2014_10_15_191204_create_setting_translations_table.php
...s/2014_10_15_191204_create_setting_translations_table.php
+38
-0
Setting.php
Entities/Setting.php
+7
-0
SettingController.php
Http/Controllers/Admin/SettingController.php
+30
-0
routes.php
Http/routes.php
+8
-1
SettingServiceProvider.php
Providers/SettingServiceProvider.php
+14
-1
EloquentSettingRepository.php
Repositories/Eloquent/EloquentSettingRepository.php
+23
-0
SettingRepository.php
Repositories/SettingRepository.php
+7
-0
fields.blade.php
Resources/views/admin/partials/fields.blade.php
+10
-0
settings.blade.php
Resources/views/admin/settings.blade.php
+39
-2
module.json
module.json
+4
-1
No files found.
Composers/SidebarViewComposer.php
View file @
d3b42637
...
...
@@ -10,7 +10,7 @@ class SidebarViewComposer
$view
->
items
->
put
(
'setting'
,
[
'weight'
=>
5
,
'request'
=>
"*/
$view->prefix
/settings"
,
'route'
=>
'dashboard.setting
s
'
,
'route'
=>
'dashboard.setting
.index
'
,
'icon-class'
=>
'fa fa-cog'
,
'title'
=>
'Settings'
,
]);
...
...
Database/Migrations/2014_10_14_200250_create_settings_table.php
View file @
d3b42637
...
...
@@ -14,9 +14,6 @@ class CreateSettingsTable extends Migration
{
Schema
::
create
(
'settings'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
);
$table
->
string
(
'name'
);
$table
->
string
(
'value'
);
$table
->
text
(
'description'
);
$table
->
timestamps
();
});
}
...
...
Database/Migrations/2014_10_15_191204_create_setting_translations_table.php
0 → 100644
View file @
d3b42637
<?php
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
CreateSettingTranslationsTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'setting_translations'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
);
$table
->
integer
(
'setting_id'
)
->
unsigned
();
$table
->
string
(
'locale'
)
->
index
();
$table
->
string
(
'name'
);
$table
->
string
(
'value'
);
$table
->
text
(
'description'
);
$table
->
unique
([
'setting_id'
,
'locale'
]);
$table
->
foreign
(
'setting_id'
)
->
references
(
'id'
)
->
on
(
'settings'
)
->
onDelete
(
'cascade'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
drop
(
'setting_translations'
);
}
}
Entities/Setting.php
0 → 100644
View file @
d3b42637
<?php
namespace
Modules\Setting\Entities
;
use
Illuminate\Database\Eloquent\Model
;
class
Setting
extends
Model
{
}
\ No newline at end of file
Http/Controllers/SettingController.php
→
Http/Controllers/
Admin/
SettingController.php
View file @
d3b42637
<?php
namespace
Modules\Setting\Http\Controllers
;
<?php
namespace
Modules\Setting\Http\Controllers
\Admin
;
use
Illuminate\Support\Facades\View
;
use
Modules\Core\Http\Controllers\Admin\AdminBaseController
;
use
Modules\Setting\Repositories\SettingRepository
;
class
SettingController
extends
AdminBaseController
{
/**
* @var SettingRepository
*/
private
$setting
;
public
function
__construct
(
SettingRepository
$setting
)
{
parent
::
__construct
();
$this
->
setting
=
$setting
;
}
public
function
index
()
{
return
View
::
make
(
'setting::admin.settings'
);
}
public
function
store
()
{
}
}
\ No newline at end of file
Http/routes.php
View file @
d3b42637
...
...
@@ -3,6 +3,13 @@
Route
::
group
([
'prefix'
=>
LaravelLocalization
::
setLocale
(),
'before'
=>
'LaravelLocalizationRedirectFilter|auth.admin'
],
function
()
{
Route
::
group
([
'prefix'
=>
Config
::
get
(
'core::core.admin-prefix'
),
'namespace'
=>
'Modules\Setting\Http\Controllers'
],
function
()
{
Route
::
get
(
'settings'
,
[
'as'
=>
'dashboard.settings'
,
'uses'
=>
'SettingController@index'
]);
Route
::
resource
(
'settings'
,
'Admin\SettingController'
,
[
'except'
=>
[
'show'
],
'names'
=>
[
'index'
=>
'dashboard.setting.index'
,
'create'
=>
'dashboard.setting.create'
,
'store'
=>
'dashboard.setting.store'
,
'edit'
=>
'dashboard.setting.edit'
,
'update'
=>
'dashboard.setting.update'
,
'destroy'
=>
'dashboard.setting.destroy'
,
]]);
});
});
Providers/SettingServiceProvider.php
View file @
d3b42637
<?php
namespace
Modules\Setting\Providers
;
use
Illuminate\Support\ServiceProvider
;
use
Modules\Setting\Entities\Setting
;
use
Modules\Setting\Repositories\Eloquent\EloquentSettingRepository
;
class
SettingServiceProvider
extends
ServiceProvider
{
...
...
@@ -18,7 +20,9 @@ class SettingServiceProvider extends ServiceProvider {
*/
public
function
register
()
{
//
$this
->
app
->
booted
(
function
(
$app
)
{
$this
->
registerBindings
();
});
}
/**
...
...
@@ -31,4 +35,13 @@ class SettingServiceProvider extends ServiceProvider {
return
array
();
}
private
function
registerBindings
()
{
$this
->
app
->
bind
(
'Modules\Setting\Repositories\SettingRepository'
,
function
()
{
return
new
EloquentSettingRepository
(
new
Setting
);
}
);
}
}
Repositories/Eloquent/EloquentSettingRepository.php
0 → 100644
View file @
d3b42637
<?php
namespace
Modules\Setting\Repositories\Eloquent
;
use
Modules\Core\Repositories\Eloquent\EloquentBaseRepository
;
use
Modules\Setting\Repositories\SettingRepository
;
class
EloquentSettingRepository
extends
EloquentBaseRepository
implements
SettingRepository
{
/**
* Update a resource
* @param $id
* @param $data
* @return mixed
*/
public
function
update
(
$id
,
$data
)
{
}
public
function
create
(
$data
)
{
}
}
\ No newline at end of file
Repositories/SettingRepository.php
0 → 100644
View file @
d3b42637
<?php
namespace
Modules\Setting\Repositories
;
use
Modules\Core\Repositories\BaseRepository
;
interface
SettingRepository
extends
BaseRepository
{
}
\ No newline at end of file
Resources/views/admin/partials/fields.blade.php
0 → 100644
View file @
d3b42637
<div
class=
'form-group{{ $errors->has("site-name[$lang]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("site-name[$lang]", 'Site name:') !!}
{!! Form::text("site-name[$lang]", Input::old("site-name[$lang]"), ['class' => 'form-control', 'placeholder' => 'Site name']) !!}
{!! $errors->first("site-name[$lang]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
</div>
<div
class=
'form-group{{ $errors->has("site-description[$lang]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("site-description[$lang]", 'Site-description:') !!}
{!! Form::textarea("site-description[$lang]", Input::old("site-description[$lang]"), ['class' => 'form-control', 'placeholder' => 'Site description']) !!}
{!! $errors->first("site-description[$lang]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
</div>
\ No newline at end of file
Resources/views/admin/settings.blade.php
View file @
d3b42637
...
...
@@ -10,9 +10,46 @@
@
stop
@
section
(
'content'
)
@
include
(
'flash::message'
)
{
!!
Form
::
open
([
'route'
=>
[
'dashboard.setting.store'
],
'method'
=>
'post'
])
!!
}
<
div
class
="
row
">
<div class="
col
-
md
-
12
">
<p>Settings</p>
<div class="
col
-
md
-
8
">
<div class="
box
box
-
info
">
<div class="
box
-
header
">
<h3 class="
box
-
title
">General settings</h3>
</div>
<div class="
box
-
body
">
<div class="
nav
-
tabs
-
custom
">
<ul class="
nav
nav
-
tabs
">
<li class="
{{
App
::
getLocale
()
==
'en'
?
'active'
:
''
}}
"><a href="
#tab_1-1" data-toggle="tab">{{ trans('core::core.tab.english') }}</a></li>
<
li
class
="{{
App
::
getLocale
()
==
'fr'
?
'active'
:
''
}}
"><a href="
#tab_2-2" data-toggle="tab">{{ trans('core::core.tab.french') }}</a></li>
</
ul
>
<
div
class
="
tab
-
content
">
<div class="
tab
-
pane
active
" id="
tab_1
-
1
">
@include('setting::admin.partials.fields', ['lang' => 'en'])
</div>
<div class="
tab
-
pane
" id="
tab_2
-
2
">
@include('setting::admin.partials.fields', ['lang' => 'fr'])
</div>
</div>
</div>
</div>
<div class="
box
-
footer
">
<button type="
submit
" class="
btn
btn
-
primary
btn
-
flat
">{{ trans('user::button.create') }}</button>
<a class="
btn
btn
-
danger
pull
-
right
btn
-
flat
" href="
{{
URL
::
route
(
'dashboard.user.index'
)}}
"><i class="
fa
fa
-
times
"></i> {{ trans('user::button.cancel') }}</a>
</div>
</div>
</div>
<div class="
col
-
md
-
4
">
<div class="
box
box
-
info
">
<div class="
box
-
header
"><h3 class="
box
-
title
">Module Settings</h3></div>
<div class="
box
-
body
">
<ul>
<li><a href="">Module 1</a></li>
</ul>
</div>
</div>
</div>
</div>
{!! Form::close() !!}
@stop
\ No newline at end of file
module.json
View file @
d3b42637
...
...
@@ -5,5 +5,8 @@
"keywords"
:
[
],
"active"
:
1
"active"
:
1
,
"providers"
:
[
"Modules
\\
Setting
\\
Providers
\\
SettingServiceProvider"
]
}
\ 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