9 changed files with 188 additions and 16 deletions
-
32app/Http/Controllers/Users/AgencyController.php
-
22app/Services/Option.php
-
20resources/lang/id/agency.php
-
3resources/views/pages/partials/dashboard-nav-tabs.blade.php
-
13resources/views/users/agency/edit.blade.php
-
10resources/views/users/agency/show.blade.php
-
19routes/web/account.php
-
46tests/Feature/Users/UserProfileTest.php
-
37tests/Unit/Services/SiteOptionTest.php
@ -0,0 +1,32 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Http\Controllers\Users; |
||||
|
|
||||
|
use App\Http\Controllers\Controller; |
||||
|
use Option; |
||||
|
|
||||
|
class AgencyController extends Controller |
||||
|
{ |
||||
|
public function show() |
||||
|
{ |
||||
|
return view('users.agency.show'); |
||||
|
} |
||||
|
|
||||
|
public function edit() |
||||
|
{ |
||||
|
return view('users.agency.edit'); |
||||
|
} |
||||
|
|
||||
|
public function update() |
||||
|
{ |
||||
|
Option::set('agency_name', request('name')); |
||||
|
Option::set('agency_email', request('email')); |
||||
|
Option::set('agency_website', request('website')); |
||||
|
Option::set('agency_address', request('address')); |
||||
|
Option::set('agency_phone', request('phone')); |
||||
|
|
||||
|
flash(trans('agency.updated'), 'success'); |
||||
|
|
||||
|
return redirect()->route('users.agency.show'); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
<?php |
||||
|
|
||||
|
return [ |
||||
|
// Labels
|
||||
|
'agency' => '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', |
||||
|
]; |
||||
@ -0,0 +1,37 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace Tests\Unit\Services; |
||||
|
|
||||
|
use Option; |
||||
|
use Tests\TestCase; |
||||
|
|
||||
|
class SiteOptionTest extends TestCase |
||||
|
{ |
||||
|
/** @test */ |
||||
|
public function option_can_be_set() |
||||
|
{ |
||||
|
Option::set('testing_key', 'testing_value'); |
||||
|
|
||||
|
$this->seeInDatabase('site_options', [ |
||||
|
'key' => 'testing_key', |
||||
|
'value' => 'testing_value', |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** @test */ |
||||
|
public function option_can_be_get() |
||||
|
{ |
||||
|
\DB::table('site_options')->insert([ |
||||
|
'key' => 'testing_key', |
||||
|
'value' => 'testing_value', |
||||
|
]); |
||||
|
|
||||
|
$this->assertEquals('testing_value', Option::get('testing_key')); |
||||
|
} |
||||
|
|
||||
|
/** @test */ |
||||
|
public function option_can_has_default_value_if_value_not_exists() |
||||
|
{ |
||||
|
$this->assertEquals('testing_value', Option::get('testing_key', 'testing_value')); |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue