Commit b296ec58 by Aan Choesni Herlingga

master setting

parent 41af4b84
<?php
namespace App\Http\Controllers\Webprofile\Backend;
use App\Models\Webprofile\Setting;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Validator;
use Uuid;
use Alert;
use Session;
use Crypt;
use App\Helpers\InseoHelper;
use App\Http\Requests\SettingRequest;
use Auth;
class SettingController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data = Setting::orderBy('name_setting', 'ASC')->get();
$data = [
'data' => $data,
];
return view('webprofile.backend.setting.index', $data)->withTitle(trans('feature.setting'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('webprofile.backend.setting.create')->withTitle(trans('feature.create_setting'));
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(SettingRequest $request)
{
$data = $request->except('_token');
$data['userid_created'] = Auth::user()->id;
$data['userid_updated'] = Auth::user()->id;
Setting::create($data);
Alert::success('Data berhasil disimpan')->persistent('Ok');
$successmessage = "Proses Tambah Pengaturan Berhasil !!";
return redirect()->route('settings.index')->with('successMessage', $successmessage);
}
/**
* Display the specified resource.
*
* @param \App\Models\Setting $setting
* @return \Illuminate\Http\Response
*/
public function show(Setting $setting)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Setting $setting
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
try {
$data = Setting::find(Crypt::decrypt($id));
return view('webprofile.backend.setting.edit', compact('data'))->withTitle(trans('feature.edit_setting'));
} catch (\Exception $id) {
return redirect()->route('settings.index');
}
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Setting $setting
* @return \Illuminate\Http\Response
*/
public function update(SettingRequest $request, $id)
{
$setting = Setting::findOrFail($id);
$data = $request->except('_token');
$data['userid_updated'] = Auth::user()->id;
$setting->update($data);
Alert::success('Data berhasil diubah')->persistent('Ok');
return redirect()->route('settings.index');
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Setting $setting
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class SettingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name_setting' => 'required',
'value_setting' => 'required',
];
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function messages()
{
return [
'required' => 'Form Input Ini Tidak Boleh Kosong / Harus Diisi',
];
}
}
......@@ -7,6 +7,7 @@ return [
'update' => 'Update',
'delete' => 'Delete',
'save' => 'Save',
'cancel' => 'Cancel',
'number' => 'Num',
'name' => 'Name',
'status' => 'Status',
......@@ -23,4 +24,5 @@ return [
'viewer' => 'Viewer',
'command' => 'Command',
'event_date' => 'Event Date',
'value' => 'Value',
];
......@@ -7,6 +7,7 @@ return [
'update' => 'Update',
'delete' => 'Hapus',
'save' => 'Simpan',
'cancel' => 'Batal',
'number' => 'No',
'name' => 'Nama',
'status' => 'Status',
......@@ -23,4 +24,5 @@ return [
'viewer' => 'Penonton',
'command' => 'Komentar',
'event_date' => 'Tanggal Kegiatan',
'value' => 'Nilai',
];
\ No newline at end of file
......@@ -5,7 +5,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">Dashboard</a></li>
<li><a href="{{ url('dashboard') }}">Dashboard</a></li>
<li class="active">Tambah Kategori</li>
@stop
......
......@@ -5,7 +5,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">Dashboard</a></li>
<li><a href="{{ url('dashboard') }}">Dashboard</a></li>
<li class="active">Ubah Kategori</li>
@stop
......
......@@ -10,7 +10,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">@lang('label.dashboard')</a></li>
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.category')</li>
@stop
......
......@@ -14,7 +14,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">@lang('label.dashboard')</a></li>
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.create_information')</li>
@stop
......
......@@ -14,7 +14,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">@lang('label.dashboard')</a></li>
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.create_information')</li>
@stop
......
......@@ -10,7 +10,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">@lang('label.dashboard')</a></li>
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.information')</li>
@stop
......
......@@ -42,5 +42,5 @@
<a href="{{ url('webprofile/layouts') }}"><span class="fa fa-tasks"></span> <span class="xn-text">@lang('feature.layout')</span></a>
</li>
<li>
<a href="{{ url('webprofile/setting') }}"><span class="fa fa-gears"></span><span class="xn-text">@lang('feature.setting')</span></a>
<a href="{{ url('webprofile/settings') }}"><span class="fa fa-gears"></span><span class="xn-text">@lang('feature.setting')</span></a>
</li>
......@@ -14,7 +14,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">@lang('label.dashboard')</a></li>
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.create_page')</li>
@stop
......
......@@ -14,7 +14,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">@lang('label.dashboard')</a></li>
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.create_page')</li>
@stop
......
......@@ -10,7 +10,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">@lang('label.dashboard')</a></li>
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.page')</li>
@stop
......
......@@ -14,7 +14,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">@lang('label.dashboard')</a></li>
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.create_post')</li>
@stop
......
......@@ -14,7 +14,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">@lang('label.dashboard')</a></li>
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.create_post')</li>
@stop
......
......@@ -10,7 +10,7 @@
@stop
@section('breadcrumbs')
<li><a href="{{URL::to('dashboard')}}">@lang('label.dashboard')</a></li>
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.post')</li>
@stop
......
@extends('webprofile.backend.layouts.master')
@section('title')
{{ $title }}
@stop
@section('breadcrumbs')
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.create_setting')</li>
@stop
@section('content')
{!! Form::open(array('url' => route('settings.store'), 'method' => 'POST', 'id' => 'setting', 'class' => 'form-horizontal')) !!}
{!! csrf_field() !!}
<!-- page start-->
<div class="row">
<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.setting')</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<div class="form-group @if ($errors->has('name_setting')) has-error @endif">
<label class="col-md-2 control-label">@lang('label.name') @lang('feature.setting')</label>
<div class="col-md-10">
{{ Form::text('name_setting', old('name_setting'), array('class' => 'form-control')) }}
@if ($errors->has('name_setting'))
<label id="login-error" class="error" for="login">{{$errors->first('name_setting')}}</label>
@endif
</div>
</div>
<div class="form-group @if ($errors->has('value_setting')) has-error @endif">
<label class="col-md-2 control-label">@lang('label.value') @lang('feature.setting')</label>
<div class="col-md-10">
{{ Form::text('value_setting', old('value_setting'), array('class' => 'form-control')) }}
@if ($errors->has('value_setting'))
<label id="login-error" class="error" for="login">{{$errors->first('value_setting')}}</label>
@endif
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-footer">
<a href="{{ url('settings') }}" class="btn btn-default pull-right">@lang('label.cancel')</a>
<button class="btn btn-info pull-right">@lang('label.save')</button>
</div>
</div>
</div>
</div>
{!! Form::close() !!}
<!-- page end-->
@stop
@section('script')
{!! 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') !!}
@stop
@extends('webprofile.backend.layouts.master')
@section('title')
{{ $title }}
@stop
@section('breadcrumbs')
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.edit_setting')</li>
@stop
@section('content')
{!! Form::model($data, ['route' => ['settings.update', $data->id], 'method'=>'patch', 'class'=>'form-horizontal']) !!}
{!! csrf_field() !!}
<!-- page start-->
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><strong>@lang('label.edit')</strong> @lang('feature.setting')</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<div class="form-group @if ($errors->has('name_setting')) has-error @endif">
<label class="col-md-2 control-label">@lang('label.name') @lang('feature.setting')</label>
<div class="col-md-10">
{{ Form::text('name_setting', old('name_setting'), array('class' => 'form-control', 'readonly', 'style' => 'color: black')) }}
@if ($errors->has('name_setting'))
<label id="login-error" class="error" for="login">{{$errors->first('name_setting')}}</label>
@endif
</div>
</div>
<div class="form-group @if ($errors->has('value_setting')) has-error @endif">
<label class="col-md-2 control-label">@lang('label.value') @lang('feature.setting')</label>
<div class="col-md-10">
{{ Form::text('value_setting', old('value_setting'), array('class' => 'form-control')) }}
@if ($errors->has('value_setting'))
<label id="login-error" class="error" for="login">{{$errors->first('value_setting')}}</label>
@endif
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-footer">
<a href="{{ url('settings') }}" class="btn btn-default pull-right">@lang('label.cancel')</a>
<button class="btn btn-info pull-right">@lang('label.save')</button>
</div>
</div>
</div>
</div>
{!! Form::close() !!}
<!-- page end-->
@stop
@section('script')
{!! 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') !!}
@stop
@extends('webprofile.backend.layouts.master')
@section('title')
{{ $title }}
@stop
@section('breadcrumbs')
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.setting')</li>
@stop
@section('content')
<!-- page start-->
<div class="row">
<div class="col-lg-12">
<!-- START DEFAULT DATATABLE -->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! $title !!}</h3>
{{-- <a class="btn btn-info" href="{{URL::to('webprofile/settings/create')}}" style="margin: 0cm 0px 0cm 10px;">@lang('label.create')</a> --}}
<ul class="panel-controls">
<li><a href="#" class="panel-collapse"><span class="fa fa-angle-down"></span></a></li>
</ul>
</div>
<div class="panel-body">
<table class="table datatable table-hover" id="berita">
<thead>
<tr>
<th width="7%">@lang('label.number')</th>
<th width="33%">@lang('label.name')</th>
<th width="30%">@lang('label.value')</th>
<th align="center" width="15%">@lang('label.action')</th>
</tr>
</thead>
<tbody>
<?php $no = 1;?>
@foreach($data as $value)
<tr style="cursor:pointer">
<td align="center"><?php echo $no; ?></td>
<td>{!! $value->name_setting !!}</td>
<td>{!! $value->value_setting !!}</td>
<td style="text-align:center;">
<a href="{{ route('settings.edit', ['data'=>Crypt::encrypt($value->id)]) }}" class="btn btn-warning btn-xs"><i class="fa fa-pencil"></i></a>
</td>
<?php $no++;?>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<!-- END DEFAULT DATATABLE -->
</div>
</div>
<!-- page end-->
@stop
@section('script')
<script src="{!!asset('backend/js/datatables.net/js/jquery.dataTables.min.js') !!}"></script>
@stop
......@@ -6,6 +6,7 @@ Route::group(['middleware' => 'auth'], function () {
Route::resource('posts', 'PostController');
Route::resource('pages', 'PageController');
Route::resource('informations', 'InformationController');
Route::resource('settings', 'SettingController');
});
// });
});
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