Commit 61e704e5 by Aan Choesni Herlingga

master layouts

parent f730c7a5
<?php
namespace App\Http\Controllers\Webprofile\Backend;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Webprofile\DesignRepository;
use Crypt;
class LayoutController extends Controller
{
private $repo;
public function __construct(DesignRepository $repo)
{
$this->repo = $repo;
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$layouts = $this->repo->get();
$data = [
'layouts' => $layouts,
];
return view('webprofile.backend.design.index', $data)->withTitle(trans('feature.layout'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return redirect()->route('layouts.index');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$data = $request->except('_token');
array_key_exists('title_show', $data) ? $data['title_show'] = 1 : $data['title_show'] = 0;
$this->repo->store($data);
return redirect()->route('layouts.index');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$data = [
'position' => $id,
];
return view('webprofile.backend.design.create', $data)->withTitle(trans('label.create') . ' ' . trans('feature.' . $id));
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$layout = $this->repo->findId(Crypt::decrypt($id));
$data = [
'data' => $layout,
];
return view('webprofile.backend.design.edit', $data)->withTitle(trans('label.edit') . ' ' . trans('feature.' . $layout->name_design));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$data = $request->except(['_token', 'id']);
array_key_exists('title_show', $data) ? $data['title_show'] = 1 : $data['title_show'] = 0;
$layout = $this->repo->findId($id);
$edit = $this->repo->update($data, $layout);
return redirect()->route('layouts.index');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$data = $this->repo->findId(Crypt::decrypt($id));
$this->repo->destroy($data);
return redirect()->route('layouts.index');
}
}
......@@ -19,6 +19,7 @@ class CreateDesignTable extends Migration
$table->string('title_design')->nullable();
$table->text('value_design')->nullable();
$table->integer('urutan')->nullable();
$table->boolean('title_show')->nullable();
$table->string('userid_created', 36)->nullable();
$table->string('userid_updated', 36)->nullable();
$table->timestamps();
......
......@@ -42,4 +42,14 @@ return [
'edit_slider' => 'Edit Slider',
'edit_layout' => 'Edit Layout',
'widget_right' => 'Widget Right',
'widget_left' => 'Widget Left',
'body' => 'Body',
'quote' => 'Quote',
'footer' => 'Footer',
'footer_row_1' => 'Footer 1',
'footer_row_2' => 'Footer 2',
'footer_row_3' => 'Footer 3',
'footer_row_4' => 'Footer 4',
];
......@@ -27,4 +27,5 @@ return [
'value' => 'Value',
'upload' => 'Upload',
'download' => 'Download',
];
'title_show' => 'Title Show',
];
\ No newline at end of file
......@@ -42,4 +42,14 @@ return [
'edit_slider' => 'Ubah Slider',
'edit_layout' => 'Ubah Tampilan',
'widget_right' => 'Widget Kanan',
'widget_left' => 'Widget Kiri',
'body' => 'Body',
'quote' => 'Quote',
'footer' => 'Footer',
'footer_row_1' => 'Footer 1',
'footer_row_2' => 'Footer 2',
'footer_row_3' => 'Footer 3',
'footer_row_4' => 'Footer 4',
];
......@@ -27,4 +27,5 @@ return [
'value' => 'Nilai',
'upload' => 'Unggah',
'download' => 'Unduh',
'title_show' => 'Judul ditampilkan',
];
\ No newline at end of file
@extends('webprofile.backend.layouts.master')
@section('title')
{{ $title }}
@stop
@section('assets')
<link rel="stylesheet" href="{!! asset('backend/assets/select2/select2.min.css') !!}">
<style media="screen">
.tkh{
color: black;
}
</style>
@stop
@section('breadcrumbs')
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('label.create') @lang('feature.' . $position)</li>
@stop
@section('content')
<!-- page start-->
<div class="row">
{!! Form::open(array('url' => route('layouts.store'), 'method' => 'POST')) !!}
{!! csrf_field() !!}
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><strong>@lang('label.create')</strong> @lang('feature.' . $position)</h3>
</div>
<div class="panel-body">
<div class="row">
{{ Form::text('name_design', $position, ['style'=>'display:none;']) }}
<div class="col-md-12">
<div class="form-group @if ($errors->has('title_design')) has-error @endif">
<div class="col-md-11">
{{ Form::text('title_design', old('title_design'), array('class' => 'form-control', 'placeholder'=>trans('label.title'), 'style'=>'font-size: 14pt;')) }}
@if ($errors->has('title_design'))
<label id="login-error" class="error" for="login">{{$errors->first('title_design')}}</label>
@endif
</div>
<div class="col-md-1">
<label class="switch">
{{ Form::checkbox('title_show', 1, true, ['data-toggle'=>'tooltip', 'data-original-title'=>trans('label.title_show')]) }}
<span></span>
</label>
</div>
</div>
</div>
<div class="col-md-12">
<div class="block">
{{ Form::textarea('value_design', null, array('class'=>'summernote')) }}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-footer">
<button class="btn btn-info pull-right">@lang('label.save')</button>
</div>
</div>
</div>
{!! Form::close() !!}
</div>
<!-- page end-->
@stop
@section('script')
{!! Html::script('backend/assets/select2/select2.full.min.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-datepicker.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-timepicker.min.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-file-input.js') !!}
{!! Html::script('backend/js/plugins/summernote/summernote.js') !!}
@stop
\ No newline at end of file
@extends('webprofile.backend.layouts.master')
@section('title')
{{ $title }}
@stop
@section('assets')
<link rel="stylesheet" href="{!! asset('backend/assets/select2/select2.min.css') !!}">
<style media="screen">
.tkh{
color: black;
}
</style>
@stop
@section('breadcrumbs')
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('label.edit') @lang('feature.' . $data->name_design)</li>
@stop
@section('content')
<!-- page start-->
<div class="row">
{!! Form::model($data, ['route' => ['layouts.update', $data->id], 'method'=>'patch']) !!}
{!! csrf_field() !!}
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><strong>@lang('label.create')</strong> @lang('feature.' . $data->name_design)</h3>
</div>
<div class="panel-body">
<div class="row">
{{ Form::text('name_design', $data->name_design, ['style'=>'display:none;']) }}
<div class="col-md-12">
<div class="form-group @if ($errors->has('title_design')) has-error @endif">
<div class="col-md-11">
{{ Form::text('title_design', old('title_design'), array('class' => 'form-control', 'placeholder'=>trans('label.title'), 'style'=>'font-size: 14pt;')) }}
@if ($errors->has('title_design'))
<label id="login-error" class="error" for="login">{{$errors->first('title_design')}}</label>
@endif
</div>
<div class="col-md-1">
<label class="switch">
{{ Form::checkbox('title_show', $data->title_show, $data->title_show, ['data-toggle'=>'tooltip', 'data-original-title'=>trans('label.title_show')]) }}
<span></span>
</label>
</div>
</div>
</div>
<div class="col-md-12">
<div class="block">
{{ Form::textarea('value_design', null, array('class'=>'summernote')) }}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-footer">
<button class="btn btn-info pull-right">@lang('label.save')</button>
</div>
</div>
</div>
{!! Form::close() !!}
</div>
<!-- page end-->
@stop
@section('script')
{!! Html::script('backend/assets/select2/select2.full.min.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-datepicker.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-timepicker.min.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-file-input.js') !!}
{!! Html::script('backend/js/plugins/summernote/summernote.js') !!}
@stop
\ No newline at end of file
......@@ -11,6 +11,7 @@ Route::group(['middleware' => 'auth'], function () {
Route::resource('gallery', 'GalleryController');
Route::resource('categoriesfile', 'CategoriesFileController');
Route::resource('file', 'FileController');
Route::resource('layouts', 'LayoutController');
});
// });
});
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