Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fazo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nuriddin
fazo
Commits
d048ff7e
Commit
d048ff7e
authored
Jun 11, 2019
by
iego
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates
parent
dcfd0fe8
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
218 additions
and
97 deletions
+218
-97
ProfileController.php
app/Http/Controllers/ProfileController.php
+27
-8
addaddress.blade.php
resources/views/addaddress.blade.php
+2
-19
user.blade.php
resources/views/layouts/user.blade.php
+6
-21
address_add.blade.php
resources/views/pages/profile/address_add.blade.php
+114
-0
addresses.blade.php
resources/views/pages/profile/addresses.blade.php
+62
-36
user.blade.php
resources/views/pages/profile/user.blade.php
+4
-12
web.php
routes/web.php
+3
-1
No files found.
app/Http/Controllers/ProfileController.php
View file @
d048ff7e
...
...
@@ -21,7 +21,7 @@ class ProfileController extends Controller
{
public
function
info
()
{
return
view
(
'pages.profile.user'
,
[
return
view
(
'pages.profile.user'
,
[
'user'
=>
User
::
find
(
Auth
::
id
()),
'addresses'
=>
Address
::
where
(
'user_id'
,
Auth
::
id
())
->
get
(),
]);
...
...
@@ -41,9 +41,9 @@ class ProfileController extends Controller
try
{
$this
->
handle_save
(
$address
,
$request
);
Session
::
flash
(
'success'
,
'Адресс успешно добавлен'
);
return
redirect
(
'/profile/address/edit/'
.
$address
->
id
);
return
redirect
(
'/profile/address/edit/'
.
$address
->
id
);
}
catch
(
Exception
$ex
)
{
Session
::
flash
(
'error'
,
'Не удалось сохранить данные: '
.
$ex
->
getMessage
());
Session
::
flash
(
'error'
,
'Не удалось сохранить данные: '
.
$ex
->
getMessage
());
}
}
...
...
@@ -68,7 +68,7 @@ class ProfileController extends Controller
$this
->
handle_save
(
$address
,
$request
);
Session
::
flash
(
'success'
,
'Адресс успешно обновлен'
);
}
catch
(
Exception
$ex
)
{
Session
::
flash
(
'error'
,
'Не удалось сохранить данные: '
.
$ex
->
getMessage
());
Session
::
flash
(
'error'
,
'Не удалось сохранить данные: '
.
$ex
->
getMessage
());
}
}
...
...
@@ -136,7 +136,7 @@ class ProfileController extends Controller
$this
->
handle_profile_save
(
$model
,
$request
);
Session
::
flash
(
'success'
,
'Профиль успешно обновлен'
);
}
catch
(
Exception
$ex
)
{
Session
::
flash
(
'error'
,
'Ошибка сохранения профиля: '
.
$ex
->
getMessage
());
Session
::
flash
(
'error'
,
'Ошибка сохранения профиля: '
.
$ex
->
getMessage
());
}
}
return
view
(
'pages.profile.profile_edit'
,
[
...
...
@@ -159,7 +159,7 @@ class ProfileController extends Controller
$this
->
handle_password_change
(
$model
,
$request
);
Session
::
flash
(
'success'
,
'Пароль успешно обновлен'
);
}
catch
(
Exception
$ex
)
{
Session
::
flash
(
'error'
,
'Ошибка сохранения пароля: '
.
$ex
->
getMessage
());
Session
::
flash
(
'error'
,
'Ошибка сохранения пароля: '
.
$ex
->
getMessage
());
}
}
return
view
(
'pages.profile.change_password'
,
[
...
...
@@ -256,12 +256,31 @@ class ProfileController extends Controller
public
function
address
()
{
return
view
(
'address'
);
$units
=
Address
::
where
(
'user_id'
,
'='
,
Auth
::
user
()
->
id
);
return
view
(
'pages.profile.addresses'
,
compact
(
'units'
));
}
public
function
addaddress
()
{
return
view
(
'addaddress'
);
return
view
(
'pages.profile.address_add'
);
}
public
function
storeaddress
(
Request
$request
)
{
$address
=
new
Address
;
$address
->
fill
(
$request
->
all
());
$address
->
user_id
=
Auth
::
user
()
->
id
;
$address
->
save
();
return
redirect
()
->
route
(
'address'
);
}
public
function
destroyaddress
(
$id
)
{
Address
::
destroy
(
$id
);
return
redirect
()
->
back
()
->
with
(
'success'
,
'Адрес удален'
);
}
public
function
profile
()
...
...
resources/views/addaddress.blade.php
View file @
d048ff7e
...
...
@@ -40,28 +40,11 @@
<div class="
col
-
xs
-
12
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
address1
">
Street a
ddress...</label>
<label class="
form
-
label
" for="
forms
-
check
-
address1
">
A
ddress...</label>
<input class="
form
-
input
" id="
forms
-
check
-
address1
" type="
text
" name="
address1
" data-constraints="
@
Required
">
</div>
</div>
<div class="
col
-
xs
-
12
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
apartment1
">Apartment, suite, unit etc...</label>
<input class="
form
-
input
" id="
forms
-
check
-
apartment1
" type="
text
" name="
apartment1
" data-constraints="
@
Required
">
</div>
</div>
<div class="
col
-
xs
-
12
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
city1
">City...</label>
<input class="
form
-
input
" id="
forms
-
check
-
city1
" type="
text
" name="
city1
" data-constraints="
@
Required
">
</div>
</div>
<div class="
col
-
xs
-
12
col
-
sm
-
6
left
-
col
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
country1
">Country...</label>
<input class="
form
-
input
" id="
forms
-
check
-
country1
" type="
text
" name="
country1
" data-constraints="
@
Required
">
</div>
</div>
<div class="
col
-
xs
-
12
col
-
sm
-
6
right
-
col
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
postcode1
">Postcode...</label>
...
...
resources/views/layouts/user.blade.php
View file @
d048ff7e
...
...
@@ -66,10 +66,10 @@
<button
class=
"rd-navbar-search-form-submit fa-shopping-cart"
type=
"submit"
></button>
</form><span
class=
"rd-navbar-live-search-results"
></span>
<button
class=
"rd-navbar-search-toggle"
data-rd-navbar-toggle=
".rd-navbar-search, .rd-navbar-live-search-results"
type=
"submit"
></button>
</div><a
class=
"fa-shopping-cart"
href=
""
><span>
10
</span></a>
</div><a
class=
"fa-shopping-cart"
href=
"
shop-cart.html
"
><span>
10
</span></a>
<!-- RD Navbar Nav-->
<ul
class=
"rd-navbar-nav"
>
<li><a
href=
"
/
"
>
На главную
</a></li>
<li><a
href=
"
index.html
"
>
На главную
</a></li>
<li><a
href=
"{{ route('package') }}"
>
Посылки
</a>
</li>
...
...
@@ -89,24 +89,6 @@
</header>
<!-- Page Content-->
<main
class=
"page-content"
>
@if( Session::has( 'success' ))
<div
class=
"alert alert-success alert-dismissible fade show mt-3"
role=
"alert"
>
<strong>
Успешно!
</strong>
{{ Session::get( 'success' ) }}
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
@elseif( Session::has( 'error' ))
<div
class=
"alert alert-danger alert-dismissible fade show mt-3"
role=
"alert"
>
<strong>
Ошибка!
</strong>
{{ Session::get( 'error' ) }}
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
@endif
@yield('content')
</main>
<!-- Page Footer-->
...
...
@@ -131,10 +113,13 @@
</section>
<section
class=
"copyright bg-darkest well5"
>
<div
class=
"container"
>
<p
class=
"pull-sm-left"
>
©
<span
id=
"copyright-year"
></span>
All Rights Reserved
<a
href=
""
>
Terms of Use and Privacy Policy
</a></p>
<p
class=
"pull-sm-left"
>
©
<span
id=
"copyright-year"
></span>
All Rights Reserved
<a
href=
"
terms.html
"
>
Terms of Use and Privacy Policy
</a></p>
<ul
class=
"list-inline pull-sm-right offset-3"
>
<li><a
class=
"fa-facebook"
href=
"#"
></a></li>
<li><a
class=
"fa-twitter"
href=
"#"
></a></li>
<li><a
class=
"fa-pinterest-p"
href=
"#"
></a></li>
<li><a
class=
"fa-vimeo"
href=
"#"
></a></li>
<li><a
class=
"fa-google"
href=
"#"
></a></li>
<li><a
class=
"fa-rss"
href=
"#"
></a></li>
</ul>
</div>
...
...
resources/views/pages/profile/address_add.blade.php
0 → 100644
View file @
d048ff7e
@
extends
(
'layouts.user'
)
@
section
(
'content'
)
<
section
class
="
bg
-
light
section
-
lg
">
<ol class="
breadcrumb
">
<li><a href="
/
">Home</a></li>
<li>Address
</li>
<li class="
active
">Add</li>
</ol>
</section>
<div class="
section
section
-
inset
-
1
">
<div class="
container
">
<div class="
row
">
<div class="
col
-
xs
-
12
col
-
md
-
8
col
-
md
-
offset
-
2
">
<section class="
section
section
-
inset
-
1
">
<h4>New Address</h4>
<!-- RD Mailform-->
<form class="
rd
-
mailform
" data-form-output="
form
-
output
-
global
" data-form-type="
forms
" method="
post
" action="
{{
route
(
'address.store'
)
}}
">
@csrf
<div class="
row
row
-
10
">
<div class="
col
-
xs
-
12
col
-
sm
-
6
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
name1
">Your first name...</label>
<input class="
form
-
input
" id="
forms
-
check
-
name1
" type="
text
" name="
name1
" data-constraints="
@
Required
">
</div>
</div>
<div class="
col
-
xs
-
12
col
-
sm
-
6
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
last
-
name1
">Your last name...</label>
<input class="
form
-
input
" id="
forms
-
check
-
last
-
name1
" type="
text
" name="
last
-
name1
" data-constraints="
@
Required
">
</div>
</div>
<div class="
col
-
xs
-
12
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
company1
">Passport...</label>
<input class="
form
-
input
" id="
forms
-
check
-
company1
" type="
text
" name="
company1
" data-constraints="
@
Required
">
</div>
</div>
<div class="
col
-
xs
-
12
select
">
<!-- RD SelectMenu-->
<div class="
form
-
wrap
form
-
wrap
-
validation
">
<label class="
form
-
label
" for="
involve
-
form
-
country1
"></label>
<select class="
form
-
input
" id="
involve
-
form
-
country1
" id="
country
" name="
country
" data-placeholder="
Select
Your
Country
">
@foreach(\App\Models\Address::
$country
as
$key
=>
$value
)
<option value="
{{
$key
}}
" >{{
$value
}}</option>
@endforeach
</select>
</div>
</div>
<div class="
col
-
xs
-
12
select
">
<!-- RD SelectMenu-->
<div class="
form
-
wrap
form
-
wrap
-
validation
">
<label class="
form
-
label
" for="
involve
-
form
-
country1
"></label>
<select class="
form
-
input
" id="
involve
-
form
-
country1
" name="
oblast
" data-placeholder="
Select
Your
Area
">
@foreach(\App\Models\Address::
$oblast
as
$key
=>
$value
)
<option value="
{{
$key
}}
" >{{
$value
}}</option>
@endforeach
</select>
</div>
</div>
<div class="
col
-
xs
-
12
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
city
">City</label>
<input type="
text
" class="
form
-
input
" id="
forms
-
check
-
city
" name="
city
" placeholder="" value="">
</div>
</div>
<div class="
col
-
xs
-
12
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
street
">Street</label>
<input type="
text
" class="
form
-
input
" id="
forms
-
check
-
street
" name="
street
" placeholder="" value="">
</div>
</div>
<div class="
col
-
xs
-
12
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
house
">House</label>
<input type="
text
" class="
form
-
input
" id="
forms
-
check
-
house
" name="
house
" placeholder="" value="">
</div>
</div>
<div class="
col
-
xs
-
12
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
appartment
">Apartment</label>
<input type="
text
" class="
form
-
input
" id="
forms
-
check
-
appartment
" name="
apartment
" placeholder="" value="">
</div>
</div>
<div class="
col
-
xs
-
12
col
-
sm
-
6
right
-
col
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
postcode1
">Postcode...</label>
<input class="
form
-
input
" id="
forms
-
check
-
postcode1
" type="
text
" name="
zip
" data-constraints="
@
Required
">
</div>
</div>
<div class="
col
-
xs
-
12
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
phone
">Phone...</label>
<input class="
form
-
input
" id="
forms
-
check
-
phone
" type="
text
" name="
postcode
" data-constraints="
@
Required
">
</div>
</div>
</div>
<button class="
btn
btn
-
primary
btn
-
sm
btn
-
min
-
width
-
lg
offset
-
5
" type="
submit
">Add</button>
</form>
</section>
</div>
</div>
</div>
</div>
@endsection
resources/views/pages/profile/addresses.blade.php
View file @
d048ff7e
<table
class=
"table table-bordered table-striped table-sm"
>
<thead>
<tr>
<th>
Имя
</th>
<th>
Скан-копия паспорта
</th>
<th>
Адресс
</th>
<th>
Телефон
</th>
<th>
По умолчанию
</th>
<th>
Действия
</th>
</tr>
</thead>
<tbody>
@foreach($addresses as $address)
<tr>
<td>
{{ $address->firstname }} {{ $address->secondname }} {{ $address->fathername }}
</td>
<td><a
href=
"{{ $address->image->url() }}"
>
{{ $address->image->upload_name }}
</a></td>
<td>
Почтовый индекс: {{ $address->zip }}
{{ $address->getFormated() }}
</td>
<td>
{{ $address->phone }}
</td>
<td
class=
"text-center"
>
{{ $address->is_default ? 'Да' : '' }}
</td>
<td>
<div
class=
"btn-group"
role=
"group"
>
<button
id=
"btnGroupDrop1"
type=
"button"
class=
"btn btn-info dropdown-toggle btn-sm"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
Управление
</button>
<div
class=
"dropdown-menu"
aria-labelledby=
"btnGroupDrop1"
>
<a
class=
"dropdown-item"
href=
"{{ url('/profile/address/set_default/'.$address->id) }}"
>
Сделать адресом по умолчанию
</a>
<a
class=
"dropdown-item"
href=
"{{ url('/profile/address/edit/'.$address->id) }}"
>
Редактировать
</a>
<a
class=
"dropdown-item"
href=
"{{ url('/profile/address/delete/'.$address->id) }}"
>
Удалить
</a>
@
extends
(
'layouts.user'
)
@
section
(
'content'
)
<
section
class
="
bg
-
light
section
-
lg
">
<ol class="
breadcrumb
">
</ol>
</section>
<section class="
section
section
-
inset
-
1
">
<div class="
container
">
<div class="
row
">
<div class="
col
-
xs
-
12
section
-
inset
-
1
">
<div class="
table
-
responsive
">
<table class="
table
table
-
hover
text
-
left
">
<thead>
<tr class="
bg
-
dark
">
<th>#</th>
<th>Name</th>
<th>Passport</th>
<th>Adress</th>
<th>Phone</th>
<th>Manage</th>
</tr>
</thead>
<tbody>
@foreach(
$units
as
$i
=>
$unit
)
<tr>
<td>{{
$i
++ }}</td>
<td>{{
$unit->firstname
}} {{
$unit->lastname
}}</td>
<td>{{
$unit->passport
}}
</td>
<td>{{
$unit->address
}}</td>
<td>
{{
$unit->phone
}}
</td>
<td>
<form action="
{{
route
(
'address.destroy'
,
$device
->
id
)
}}
" method="
POST
">
@csrf
@method('DELETE')
<a href="
/
address
/
{{
$unit
->
id
}}
/
edit
"><i class="
fa
fa
-
pencil
"></i></a>
<button class="
fa
fa
-
times
-
circle
" >
</button></form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<!-- RD Mailform-->
<a class="
btn
btn
-
primary
btn
-
sm
pull
-
sm
-
right
" href="
{{
route
(
'address.add'
)
}}
" >Add Address</a>
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
\ No newline at end of file
</div>
</section>
@endsection
resources/views/pages/profile/user.blade.php
View file @
d048ff7e
@
extends
(
'layouts.user'
)
@
section
(
'content'
)
<
div
class
="
alert
alert
-
danger
" role="
alert
">
A simple danger alert—check it out!
</div>
<section class="
bg
-
light
section
-
lg
">
<ol class="
breadcrumb
">
<li><a href="
{{
route
(
'home'
)
}}
">Home</a></li>
...
...
@@ -26,7 +29,7 @@
</div>
<div class="
col
-
xs
-
6
">
<form action="
{{
route
(
'profile.save'
)
}}
" method="
post
" >
@csrf
@csrf
<div class="
row
row
-
10
">
<div class="
col
-
xs
-
12
col
-
sm
-
6
right
-
col
">
<div class="
form
-
wrap
">
...
...
@@ -52,17 +55,6 @@
<input class="
form
-
input
" id="
forms
-
check
-
postcode1
" type="
text
" name="
phone
" value="
{{
Auth
::
user
()
->
phone
}}
" placeholder="
Phone
...
" data-constraints="
@
Required
">
</div>
</div>
<div class="
col
-
xs
-
12
col
-
sm
-
6
right
-
col
">
<div class="
form
-
wrap
">
<input class="
form
-
input
" id="
password
" type="
text
" name="
password
" value="" placeholder="
Password
" data-constraints="
@
Required
">
</div>
</div>
<div class="
col
-
xs
-
12
col
-
sm
-
6
left
-
col
">
<div class="
form
-
wrap
">
<input class="
form
-
input
" id="
password_confirmation
" type="
text
" name="
password_confirmation
" value="" placeholder="
Password
Confirmation
" data-constraints="
@
Required
">
</div>
</div>
</div>
<button class="
btn
btn
-
primary
btn
-
xs
" >Save</button>
</form>
...
...
routes/web.php
View file @
d048ff7e
...
...
@@ -41,7 +41,9 @@ Route::get('/packages/pay', 'PackagesController@pay');
Route
::
get
(
'/packages/addr'
,
'PackagesController@addr'
);
Route
::
get
(
'/packages'
,
'PackagesController@index'
)
->
name
(
'package'
);
Route
::
get
(
'/profile/address'
,
'ProfileController@address'
)
->
name
(
'address'
);
Route
::
get
(
'/profile/addaddress'
,
'ProfileController@addaddress'
);
Route
::
get
(
'/profile/addaddress'
,
'ProfileController@addaddress'
)
->
name
(
'address.add'
);
Route
::
post
(
'/profile/storeaddress'
,
'ProfileController@storeaddress'
)
->
name
(
'address.store'
);
Route
::
delete
(
'/profile/{id}'
,
'ProfileController@deleteaddress'
)
->
name
(
'address.destroy'
);
Route
::
get
(
'/profile'
,
'ProfileController@profile'
);
Route
::
post
(
'/profile/save'
,
'ProfileController@save'
)
->
name
(
'profile.save'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment