diff --git a/app/Http/Controllers/Users/AgencyController.php b/app/Http/Controllers/Users/AgencyController.php new file mode 100644 index 0000000..9973b11 --- /dev/null +++ b/app/Http/Controllers/Users/AgencyController.php @@ -0,0 +1,32 @@ +route('users.agency.show'); + } +} diff --git a/app/Services/Option.php b/app/Services/Option.php index f6b77cf..52a0490 100644 --- a/app/Services/Option.php +++ b/app/Services/Option.php @@ -3,11 +3,10 @@ namespace App\Services; use App\Entities\Options\Option as SiteOption; -use Cache; /** -* Option Class (Site Option Service) -*/ + * Option Class (Site Option Service) + */ class Option { @@ -32,4 +31,21 @@ class Option } return $default; } -} \ No newline at end of file + + public function set($key, string $value) + { + $option = $this->option->where('key', $key)->first(); + + if ($option) { + $option->value = $value; + $option->save(); + } else { + $option = new SiteOption; + $option->key = $key; + $option->value = $value; + $option->save(); + } + + return $value; + } +} diff --git a/resources/lang/id/agency.php b/resources/lang/id/agency.php new file mode 100644 index 0000000..c06b96b --- /dev/null +++ b/resources/lang/id/agency.php @@ -0,0 +1,20 @@ + 'Agensi', + 'not_found' => 'Agensi tidak ditemukan', + 'detail' => 'Detail Agensi', + + // Actions + 'edit' => 'Edit Agensi', + 'update' => 'Update Agensi', + 'updated' => 'Update data Agensi telah berhasil.', + + // Attributes + 'name' => 'Nama Agensi', + 'email' => 'Email Agensi', + 'website' => 'Website Agensi', + 'address' => 'Alamat Agensi', + 'phone' => 'Telp. Agensi', +]; diff --git a/resources/views/pages/partials/dashboard-nav-tabs.blade.php b/resources/views/pages/partials/dashboard-nav-tabs.blade.php index 49ea467..2beb579 100644 --- a/resources/views/pages/partials/dashboard-nav-tabs.blade.php +++ b/resources/views/pages/partials/dashboard-nav-tabs.blade.php @@ -7,6 +7,9 @@ {!! link_to_route('users.profile.show', trans('auth.profile')) !!} @can('manage_agency') +
  • + {!! link_to_route('users.agency.show', trans('nav_menu.agency')) !!} +
  • {!! link_to_route('users.index', trans('user.list')) !!}
  • diff --git a/resources/views/users/agency/edit.blade.php b/resources/views/users/agency/edit.blade.php index fd9b633..c803f8a 100644 --- a/resources/views/users/agency/edit.blade.php +++ b/resources/views/users/agency/edit.blade.php @@ -5,13 +5,12 @@ @section('content-dashboard')
    - user()->agency;?> - {{ Form::model($agency, ['route' => 'users.agency.update', 'method' => 'patch']) }} - {!! FormField::text('name') !!} - {!! FormField::email('email') !!} - {!! FormField::text('website') !!} - {!! FormField::textarea('address') !!} - {!! FormField::text('phone') !!} + {{ Form::open(['route' => 'users.agency.update', 'method' => 'patch']) }} + {!! FormField::text('name', ['value' => Option::get('agency_name')]) !!} + {!! FormField::email('email', ['value' => Option::get('agency_email')]) !!} + {!! FormField::text('website', ['value' => Option::get('agency_phone')]) !!} + {!! FormField::textarea('address', ['value' => Option::get('agency_address')]) !!} + {!! FormField::text('phone', ['value' => Option::get('agency_website')]) !!} {{ Form::submit(trans('agency.update'), ['class' => 'btn btn-info']) }} {{ link_to_route('users.agency.show', trans('app.cancel'), [], ['class' => 'btn btn-default']) }} {{ Form::close() }} diff --git a/resources/views/users/agency/show.blade.php b/resources/views/users/agency/show.blade.php index b64c584..e0f977e 100644 --- a/resources/views/users/agency/show.blade.php +++ b/resources/views/users/agency/show.blade.php @@ -7,11 +7,11 @@
    - - - - - + + + + +
    {{ trans('agency.name') }}{{ $agency->name }}
    {{ trans('agency.email') }}{{ $agency->email }}
    {{ trans('agency.phone') }}{{ $agency->phone }}
    {{ trans('agency.address') }}{!! nl2br($agency->address) !!}
    {{ trans('agency.website') }}{{ $agency->website }}
    {{ trans('agency.name') }}{{ Option::get('agency_name') }}
    {{ trans('agency.email') }}{{ Option::get('agency_email') }}
    {{ trans('agency.phone') }}{{ Option::get('agency_phone') }}
    {{ trans('agency.address') }}{!! nl2br(Option::get('agency_address')) !!}
    {{ trans('agency.website') }}{{ Option::get('agency_website') }}