10 changed files with 97 additions and 59 deletions
-
37app/Http/Controllers/Auth/ProfileController.php
-
13app/Http/Controllers/Users/AgencyController.php
-
5app/Http/Controllers/Users/ProfileController.php
-
1resources/lang/id/auth.php
-
4resources/views/layouts/partials/sidebar.blade.php
-
19resources/views/users/agency/edit.blade.php
-
25resources/views/users/agency/show.blade.php
-
23resources/views/users/profile/show.blade.php
-
14routes/web/account.php
-
15tests/Feature/Users/UserProfileTest.php
@ -1,37 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace App\Http\Controllers\Auth; |
|||
|
|||
use Illuminate\Http\Request; |
|||
use App\Http\Controllers\Controller; |
|||
|
|||
class ProfileController extends Controller |
|||
{ |
|||
public function __construct() |
|||
{ |
|||
$this->middleware('auth'); |
|||
} |
|||
|
|||
public function show() |
|||
{ |
|||
return view('auth.profile', ['user' => auth()->user()]); |
|||
} |
|||
|
|||
public function update(Request $request) |
|||
{ |
|||
$profileData = $request->validate([ |
|||
'name' => 'required|max:60', |
|||
'email' => 'required|email', |
|||
]); |
|||
|
|||
$user = auth()->user(); |
|||
|
|||
$user->name = $profileData['name']; |
|||
$user->email = $profileData['email']; |
|||
$user->save(); |
|||
|
|||
flash(trans('auth.profile_updated'), 'success'); |
|||
return back(); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
@extends('layouts.app') |
|||
|
|||
@section('content') |
|||
<h3 class="page-header">@lang('agency.edit')</h3> |
|||
<div class="row"> |
|||
<div class="col-md-6"> |
|||
<?php $agency = auth()->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::submit(trans('agency.update'), ['class' => 'btn btn-info']) }} |
|||
{{ Form::close() }} |
|||
</div> |
|||
</div> |
|||
|
|||
@endsection |
|||
@ -0,0 +1,25 @@ |
|||
@extends('layouts.app') |
|||
|
|||
@section('title', trans('agency.agency')) |
|||
|
|||
@section('content') |
|||
<ul class="breadcrumb hidden-print"> |
|||
<li class="active">{{ trans('agency.agency') }}</li> |
|||
</ul> |
|||
<div class="row"> |
|||
<div class="col-md-8 col-md-offset-2"> |
|||
<div class="panel panel-default"> |
|||
<table class="table"> |
|||
<tr><th class="col-xs-4">{{ trans('agency.name') }}</th><td>{{ $agency->name }}</td></tr> |
|||
<tr><th>{{ trans('agency.email') }}</th><td>{{ $agency->email }}</td></tr> |
|||
<tr><th>{{ trans('agency.phone') }}</th><td>{{ $agency->phone }}</td></tr> |
|||
<tr><th>{{ trans('agency.address') }}</th><td>{{ $agency->address }}</td></tr> |
|||
<tr><th>{{ trans('agency.website') }}</th><td>{{ $agency->website }}</td></tr> |
|||
</table> |
|||
<div class="panel-footer"> |
|||
{{ link_to_route('users.agency.edit', trans('agency.edit'), [], ['class' => 'btn btn-info']) }} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@endsection |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue