Commit 930ad2c0 authored by Nicolas Widart's avatar Nicolas Widart

Creating menus

parent 87b6ce2a
...@@ -9,8 +9,13 @@ class EloquentMenuRepository extends EloquentBaseRepository implements MenuRepos ...@@ -9,8 +9,13 @@ class EloquentMenuRepository extends EloquentBaseRepository implements MenuRepos
{ {
public function create($data) public function create($data)
{ {
$menu = new Menu;
$menu->name = $data['name'];
unset($data['name']);
$translatableData = Helper::separateLanguages($data); $translatableData = Helper::separateLanguages($data);
dd($translatableData); Helper::updateTranslated($menu, $translatableData);
Menu::create($translatableData);
return $menu;
} }
} }
...@@ -3,14 +3,3 @@ ...@@ -3,14 +3,3 @@
{!! Form::text('name', Input::old('name'), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.name')]) !!} {!! Form::text('name', Input::old('name'), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.name')]) !!}
{!! $errors->first('Name', '<span class="help-block">:message</span>') !!} {!! $errors->first('Name', '<span class="help-block">:message</span>') !!}
</div> </div>
<div class="checkbox">
<label for="status">
<input id="status"
name="status"
type="checkbox"
class="flat-blue"
value="1" />
{{ trans('menu::menu.form.status') }}
</label>
</div>
...@@ -3,3 +3,14 @@ ...@@ -3,3 +3,14 @@
{!! Form::text("title[{$lang}]", Input::old("title[{$lang}]"), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.title')]) !!} {!! Form::text("title[{$lang}]", Input::old("title[{$lang}]"), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.title')]) !!}
{!! $errors->first("title[{$lang}]", '<span class="help-block">:message</span>') !!} {!! $errors->first("title[{$lang}]", '<span class="help-block">:message</span>') !!}
</div> </div>
<div class="checkbox">
<label for="status[{{$lang}}]">
<input id="status[{{$lang}}]"
name="status[{{$lang}}]"
type="checkbox"
class="flat-blue"
value="1" />
{{ trans('menu::menu.form.status') }}
</label>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment