diff --git a/app/Http/Controllers/Settings/PageController.php b/app/Http/Controllers/Settings/PageController.php index bf67cb9..da7c267 100644 --- a/app/Http/Controllers/Settings/PageController.php +++ b/app/Http/Controllers/Settings/PageController.php @@ -81,20 +81,34 @@ class PageController extends Controller /** * Update the specified resource in storage. * - * @param @param \App\Http\Requests\Pages\UpdatePageRequest $request - * @param \App\Models\Page $page + * @param \App\Http\Requests\Pages\UpdatePageRequest $request + * @param int $id * @return \Illuminate\Http\Response */ - public function update(UpdatePageRequest $request, Page $page) : RedirectResponse + public function update(UpdatePageRequest $request, $id) { + $page = Page::findOrFail($id); // $this->pages->update($page, $request->except(['_method', '_token'])); - $input = $request->except(['_method', '_token']); + $input = $request + ->except(['_method', '_token', 'nav-tab', 'en_title', 'en_description', 'de_title', 'de_description']); // Making extra fields //$input['page_slug'] = str_slug($input['title']); $input['status'] = isset($input['status']) ? 1 : 0; $input['updated_by'] = \Auth::user()->id; - if ($page->update($input)) { + $article_data = [ + 'en' => [ + 'title' => $request->input('en_title'), + 'description' => $request->input('en_description') + ], + 'de' => [ + 'title' => $request->input('de_title'), + 'description' => $request->input('de_description') + ], + ]; + $ergebnis = array_merge($input, $article_data); + + if ($page->update($ergebnis)) { event(new PageUpdated($page)); return redirect() diff --git a/app/Http/Requests/Pages/UpdatePageRequest.php b/app/Http/Requests/Pages/UpdatePageRequest.php index 9060983..81e5e58 100644 --- a/app/Http/Requests/Pages/UpdatePageRequest.php +++ b/app/Http/Requests/Pages/UpdatePageRequest.php @@ -16,7 +16,8 @@ class UpdatePageRequest extends Request */ public function authorize() { - return true;//return access()->allow('edit-page'); + return true; + //return access()->allow('edit-page'); } /** @@ -27,8 +28,8 @@ class UpdatePageRequest extends Request public function rules() { return [ - 'title' => 'required|max:191', - 'description' => 'required', + 'en_title' => 'required|max:191' + // 'description_en' => 'required' ]; } } diff --git a/app/Http/Requests/Person/EditPersonRequest.php b/app/Http/Requests/Person/EditPersonRequest.php index 21ce4b9..271681c 100644 --- a/app/Http/Requests/Person/EditPersonRequest.php +++ b/app/Http/Requests/Person/EditPersonRequest.php @@ -6,7 +6,7 @@ use Illuminate\Validation\Rule; //https://packagist.org/packages/felixkiss/uniquewith-validator -class CreatePersonRequest extends Request +class EditPersonRequest extends Request { /** * Determine if the user is authorized to make this request. diff --git a/app/Models/Page.php b/app/Models/Page.php index 9ed2493..368be24 100644 --- a/app/Models/Page.php +++ b/app/Models/Page.php @@ -2,6 +2,7 @@ namespace App\Models; +// 1. To specify package’s class you are using use App\Models\ModelTrait; use App\Models\User; use Illuminate\Database\Eloquent\Model; @@ -10,16 +11,18 @@ use Dimsav\Translatable\Translatable; class Page extends Model { use ModelTrait; - use Translatable; - /** + use Translatable; // 2. To add translation methods + + // 3. To define which attributes needs to be translated + public $translatedAttributes = ['title', 'description']; + + /** * The database table used by the model. * * @var string */ protected $table; - - public $translatedAttributes = ['title', 'description']; - + /** * The guarded field which are not mass assignable. * diff --git a/app/Models/PageTranslation.php b/app/Models/PageTranslation.php index b5e6316..f17f16a 100644 --- a/app/Models/PageTranslation.php +++ b/app/Models/PageTranslation.php @@ -8,6 +8,6 @@ use Illuminate\Database\Eloquent\Model; class PageTranslation extends Model { public $timestamps = false; - //protected $fillable = ['description']; + protected $fillable = ['title', 'description']; protected $guarded = ['id']; } diff --git a/public/backend/tabs.css b/public/backend/tabs.css new file mode 100644 index 0000000..c2b499f --- /dev/null +++ b/public/backend/tabs.css @@ -0,0 +1,169 @@ +.tabs { + -webkit-overflow-scrolling: touch; + align-items: stretch; + display: flex; + font-size: 1rem; + justify-content: space-between; + overflow: hidden; + overflow-x: auto; + white-space: nowrap; + } + + .tabs a { + align-items: center; + border-bottom-color: #dbdbdb; + border-bottom-style: solid; + border-bottom-width: 1px; + color: #4a4a4a; + display: flex; + justify-content: center; + margin-bottom: -1px; + padding: 0.5em 1em; + vertical-align: top; + } + + .tabs a:hover { + border-bottom-color: #363636; + color: #363636; + } + + .tabs li { + display: block; + } + + .tabs li.is-active a { + border-bottom-color: #3273dc; + color: #3273dc; + } + + .tabs ul { + align-items: center; + border-bottom-color: #dbdbdb; + border-bottom-style: solid; + border-bottom-width: 1px; + display: flex; + flex-grow: 1; + flex-shrink: 0; + justify-content: flex-start; + } + + .tabs ul.is-left { + padding-right: 0.75em; + } + + .tabs ul.is-center { + flex: none; + justify-content: center; + padding-left: 0.75em; + padding-right: 0.75em; + } + + .tabs ul.is-right { + justify-content: flex-end; + padding-left: 0.75em; + } + + .tabs .icon:first-child { + margin-right: 0.5em; + } + + .tabs .icon:last-child { + margin-left: 0.5em; + } + + .tabs.is-centered ul { + justify-content: center; + } + + .tabs.is-right ul { + justify-content: flex-end; + } + + .tabs.is-boxed a { + border: 1px solid transparent; + border-radius: 4px 4px 0 0; + } + + .tabs.is-boxed a:hover { + background-color: whitesmoke; + border-bottom-color: #dbdbdb; + } + + .tabs.is-boxed li.is-active a { + background-color: white; + border-color: #dbdbdb; + border-bottom-color: transparent !important; + } + + .tabs.is-fullwidth li { + flex-grow: 1; + flex-shrink: 0; + } + + .tabs.is-toggle a { + border-color: #dbdbdb; + border-style: solid; + border-width: 1px; + margin-bottom: 0; + position: relative; + } + + .tabs.is-toggle a:hover { + background-color: whitesmoke; + border-color: #b5b5b5; + z-index: 2; + } + + .tabs.is-toggle li + li { + margin-left: -1px; + } + + .tabs.is-toggle li:first-child a { + border-radius: 4px 0 0 4px; + } + + .tabs.is-toggle li:last-child a { + border-radius: 0 4px 4px 0; + } + + .tabs.is-toggle li.is-active a { + background-color: #3273dc; + border-color: #3273dc; + color: #fff; + z-index: 1; + } + + .tabs.is-toggle ul { + border-bottom: none; + } + + .tabs.is-toggle.is-toggle-rounded li:first-child a { + border-bottom-left-radius: 290486px; + border-top-left-radius: 290486px; + padding-left: 1.25em; + } + + .tabs.is-toggle.is-toggle-rounded li:last-child a { + border-bottom-right-radius: 290486px; + border-top-right-radius: 290486px; + padding-right: 1.25em; + } + + .tabs.is-small { + font-size: 0.75rem; + } + + .tabs.is-medium { + font-size: 1.25rem; + } + + .tabs.is-large { + font-size: 1.5rem; + } + + .tab-pane { + /* background-color: azure; */ + /* border: 1px solid #dbdbdb; */ + border-bottom: 1px solid #dbdbdb; + padding: 1rem 1rem 1rem 1rem; + } \ No newline at end of file diff --git a/resources/views/settings/layouts/app.blade.php b/resources/views/settings/layouts/app.blade.php index d275311..295c69b 100644 --- a/resources/views/settings/layouts/app.blade.php +++ b/resources/views/settings/layouts/app.blade.php @@ -15,6 +15,7 @@ + @yield('styles')
diff --git a/resources/views/settings/page/edit.blade.php b/resources/views/settings/page/edit.blade.php index a926f84..7221db1 100644 --- a/resources/views/settings/page/edit.blade.php +++ b/resources/views/settings/page/edit.blade.php @@ -8,15 +8,16 @@ @endsection --}} -@section('content') {{ Form::model($page, ['method' => 'PATCH', 'route' => ['settings.page.update', $page], -'class' => 'pure-form pure-form-aligned', 'id' => 'edit-role', 'enctype' => 'multipart/form-data']) }} +@section('content') +{!! Form::model($page, ['method' => 'PATCH', 'route' => ['settings.page.update', $page->id], +'class' => 'pure-form pure-form-aligned', 'enctype' => 'multipart/form-data']) !!}