Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
store-locator
Overview
Overview
Details
Activity
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
Ajay Barthwal
store-locator
Commits
b5b0ddbb
Commit
b5b0ddbb
authored
Jul 24, 2019
by
Arpit Jain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Completed project review point and also add 404 and 405 page
parent
c683e06c
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
169 additions
and
122 deletions
+169
-122
Handler.php
application/app/Exceptions/Handler.php
+20
-0
ErrorHandlerController.php
application/app/Http/Controllers/ErrorHandlerController.php
+36
-0
SearchController.php
application/app/Http/Controllers/SearchController.php
+48
-91
404.blade.php
application/resources/views/errors/404.blade.php
+18
-0
405.blade.php
application/resources/views/errors/405.blade.php
+18
-0
autocomplete.blade.php
application/resources/views/frontend/searchs/autocomplete.blade.php
+1
-1
city_dropdown.blade.php
application/resources/views/frontend/searchs/city_dropdown.blade.php
+2
-2
detail.blade.php
application/resources/views/frontend/searchs/detail.blade.php
+3
-3
index.blade.php
application/resources/views/frontend/searchs/index.blade.php
+6
-22
review_element.blade.php
application/resources/views/frontend/searchs/review_element.blade.php
+12
-2
web.php
application/routes/web.php
+5
-1
No files found.
application/app/Exceptions/Handler.php
View file @
b5b0ddbb
...
...
@@ -46,6 +46,26 @@ class Handler extends ExceptionHandler
*/
public
function
render
(
$request
,
Exception
$exception
)
{
if
(
$this
->
isHttpException
(
$exception
)){
switch
(
$exception
->
getStatusCode
())
{
case
404
:
return
redirect
()
->
route
(
'404'
);
break
;
case
405
:
return
redirect
()
->
route
(
'405'
);
break
;
}
}
return
parent
::
render
(
$request
,
$exception
);
}
}
application/app/Http/Controllers/ErrorHandlerController.php
0 → 100644
View file @
b5b0ddbb
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
class
ErrorHandlerController
extends
Controller
{
public
function
errorCode404
()
{
return
view
(
'errors.404'
);
}
public
function
errorCode405
()
{
return
view
(
'errors.405'
);
}
}
\ No newline at end of file
application/app/Http/Controllers/SearchController.php
View file @
b5b0ddbb
...
...
@@ -34,7 +34,7 @@ class SearchController extends Controller
$apiLocaterData
=
$this
->
call_api_page
(
$api_url
,
$locality
,
$state
,
$city
,
$location
,
$ratingOrder
,
$page
);
if
(
count
(
$apiLocaterData
[
'data'
])
<
1
)
return
response
()
->
json
([
'status'
=>
'error'
,
'data'
=>
'No data found!'
])
;
return
[
'status'
=>
'error'
,
'data'
=>
'No data found!'
]
;
$locaterIds
=
collect
(
$apiLocaterData
[
'data'
])
->
pluck
(
'id'
);
...
...
@@ -58,82 +58,53 @@ class SearchController extends Controller
return
$data
;
},
$apiLocaterData
[
'data'
]);
$links
=
$apiLocaterData
[
'links'
];
$meta
=
$apiLocaterData
[
'meta'
];
$data
=
array
();
$data
[
'finalData'
]
=
$finalData
;
$data
[
'links'
]
=
$
links
;
$data
[
'meta'
]
=
$
meta
;
return
response
()
->
json
(
[
$data
[
'links'
]
=
$
apiLocaterData
[
'links'
]
;
$data
[
'meta'
]
=
$
apiLocaterData
[
'meta'
]
;
return
[
'status'
=>
'success'
,
'data'
=>
$data
]
)
;
];
}
/**
* For Rendring index page first time and FetchData in DataBase and ApiData then Match both Data Then show final array with slug
*
* */
public
function
index
(
Request
$request
)
{
$detail
=
$this
->
getApiData
();
$final
=
$detail
->
original
;
$final
=
$this
->
getApiData
();
if
(
$final
[
'status'
]
==
'success'
){
$finalData
=
$final
[
'data'
][
'finalData'
];
$links
=
$final
[
'data'
][
'links'
];
$meta
=
$final
[
'data'
][
'meta'
];
$getState
=
City
::
where
(
'type'
,
'='
,
'2'
)
->
get
()
->
toarray
();
return
view
(
'frontend.searchs.index'
,
compact
(
'finalData'
,
'links'
,
'meta'
,
'getState'
));
}
else
{
return
response
()
->
json
([
'status'
=>
'error'
,
'data'
=>
'No data found!'
]);
}
$getState
=
City
::
where
(
'type'
,
'='
,
'2'
)
->
get
()
->
toarray
();
return
view
(
'frontend.searchs.index'
,
compact
(
'finalData'
,
'links'
,
'meta'
,
'getState'
));
}
/**
* For render location list after searching
* */
public
function
searchlocater
(
Request
$request
)
{
$detail
=
$this
->
getApiData
(
$request
[
'locality'
],
$request
[
'state'
],
$request
[
'city'
],
$request
[
'location'
],
$request
[
'ratingOrder'
],
$request
[
'page'
]);
$final
=
$detail
->
original
;
$final
=
$this
->
getApiData
(
$request
[
'locality'
],
$request
[
'state'
],
$request
[
'city'
],
$request
[
'location'
],
$request
[
'ratingOrder'
],
$request
[
'page'
]);
if
(
$final
[
'status'
]
==
'success'
){
$finalData
=
$final
[
'data'
][
'finalData'
];
$links
=
$final
[
'data'
][
'links'
];
$meta
=
$final
[
'data'
][
'meta'
];
$locality
=
$request
->
locality
;
$state
=
$request
->
state
;
$city
=
$request
->
city
;
$location
=
$request
->
location
;
$ratingOrder
=
$request
->
ratingOrder
;
$html
=
view
(
'frontend.searchs.location_element'
,
compact
(
'finalData'
,
'links'
,
'locality'
,
'state'
,
'city'
,
'location'
,
'ratingOrder'
,
'meta'
))
->
render
();
return
response
()
->
json
([
'status'
=>
'success'
,
'data'
=>
$html
]);
}
else
{
}
$html
=
view
(
'frontend.searchs.location_element'
,
compact
(
'finalData'
,
'links'
,
'locality'
,
'state'
,
'city'
,
'location
'
,
'meta'
))
->
render
();
return
response
()
->
json
([
'status'
=>
'error'
,
'data'
=>
$html
])
;
$html
=
view
(
'frontend.searchs.location_element'
,
compact
(
'finalData'
,
'links
'
,
'meta'
))
->
render
();
return
[
'status'
=>
'success'
,
'data'
=>
$html
]
;
}
}
/**
* For render detail page
* */
public
function
detail
(
Request
$request
,
$slug
)
{
$pageData
=
Page
::
where
(
'pages.slug'
,
'='
,
$slug
)
...
...
@@ -142,14 +113,22 @@ class SearchController extends Controller
}))
->
first
();
/*Fetch Locater ID*/
$locatorID
=
$pageData
->
locaterlists
->
locater_identity
;
if
(
!
empty
(
$pageData
)){
$api_url
=
config
(
'app.api_location'
);
$locationDetailAPIdata
=
$this
->
call_api
(
$api_url
,
$locatorID
);
$homepage
=
Homepage
::
where
(
'homepages.status'
,
'='
,
'1'
)
->
first
();
return
view
(
'frontend.searchs.detail'
,
compact
(
'homepage'
,
'locatorID'
,
'locationDetailAPIdata'
,
'pageData'
));
/*Fetch Locater ID*/
$locatorID
=
$pageData
->
locaterlists
->
locater_identity
;
$api_url
=
config
(
'app.api_location'
);
$locationDetailAPIdata
=
$this
->
call_api
(
$api_url
,
$locatorID
);
$homepage
=
Homepage
::
where
(
'homepages.status'
,
'='
,
'1'
)
->
first
();
return
view
(
'frontend.searchs.detail'
,
compact
(
'homepage'
,
'locatorID'
,
'locationDetailAPIdata'
,
'pageData'
));
}
else
{
return
view
(
'errors.404'
);
}
}
...
...
@@ -159,36 +138,19 @@ class SearchController extends Controller
$api_url
=
config
(
'app.api_search'
);
$locationDetailAPIdata
=
$this
->
call_api_page
(
$api_url
,
$request
[
'query'
]);
if
(
empty
(
$locationDetailAPIdata
[
'data'
])){
$html
=
view
(
'frontend.searchs.autocomplete'
,
compact
(
'locationDetailAPIdata'
))
->
render
();
return
response
()
->
json
([
'status'
=>
'error'
,
'data'
=>
$html
]);
}
else
{
$html
=
view
(
'frontend.searchs.autocomplete'
,
compact
(
'locationDetailAPIdata'
))
->
render
();
return
response
()
->
json
([
'status'
=>
'success'
,
'data'
=>
$html
]);
}
$html
=
view
(
'frontend.searchs.autocomplete'
,
compact
(
'locationDetailAPIdata'
))
->
render
();
return
[
'status'
=>
'success'
,
'data'
=>
$html
];
}
/**
* For render Review ajax
* */
public
function
reviewpaginate
(
Request
$request
)
public
function
reviewPaginate
(
Request
$request
)
{
$api_url
=
config
(
'app.api'
);
$reviewData
=
$this
->
review_api_detail
(
$api_url
,
$request
->
locatorID
,
$request
->
page
);
if
(
count
(
$reviewData
[
'data'
])
<
1
)
return
''
;
return
view
(
'frontend.searchs.review_element'
,
compact
(
'reviewData'
));
}
...
...
@@ -196,22 +158,17 @@ class SearchController extends Controller
public
function
getCityValue
(
Request
$request
)
{
$getCityData
=
City
::
where
(
'cities.name'
,
'!='
,
''
)
->
where
(
'cities.parent_id'
,
'='
,
$request
->
state
)
->
pluck
(
'name'
,
'id'
)
->
toarray
();
$getCityData
=
City
::
where
(
'cities.name'
,
'!='
,
''
)
->
where
(
'cities.parent_id'
,
'='
,
$request
->
state
)
->
where
(
'cities.is_deleted'
,
'='
,
'0'
)
->
where
(
'cities.status'
,
'='
,
'1'
)
->
pluck
(
'name'
,
'id'
)
->
toarray
();
if
(
!
empty
(
$getCityData
)){
$html
=
view
(
'frontend.searchs.city_dropdown'
,
compact
(
'getCityData'
))
->
render
();
return
response
()
->
json
([
'status'
=>
'success'
,
'data'
=>
$html
]);
}
else
{
$html
=
view
(
'frontend.searchs.city_dropdown'
,
compact
(
'getCityData'
))
->
render
();
return
response
()
->
json
([
'status'
=>
'error'
,
'data'
=>
$html
]);
}
$html
=
view
(
'frontend.searchs.city_dropdown'
,
compact
(
'getCityData'
))
->
render
();
return
[
'status'
=>
'success'
,
'data'
=>
$html
];
}
}
application/resources/views/errors/404.blade.php
0 → 100644
View file @
b5b0ddbb
<!DOCTYPE html>
<html>
<head>
<title>
404 Page Not Found Error
</title>
</head>
<body>
<h1>
Sorry, Page Not Found 404
</h1>
</body>
</html>
\ No newline at end of file
application/resources/views/errors/405.blade.php
0 → 100644
View file @
b5b0ddbb
<!DOCTYPE html>
<html>
<head>
<title>
405 Page Not Found Error
</title>
</head>
<body>
<h1>
Sorry, Page Not Found 405
</h1>
</body>
</html>
\ No newline at end of file
application/resources/views/frontend/searchs/autocomplete.blade.php
View file @
b5b0ddbb
...
...
@@ -6,6 +6,6 @@
</ul>
@else
<ul class="
dropdown
-
menu
" style="
display
:
block
;
position
:
relative
">
<li><i class="
mdi
mdi
-
map
-
marker
"></i><a href="
javascript
:
void
(
0
);
">
</a>No data found!
</li>
<li><i class="
mdi
mdi
-
map
-
marker
"></i><a href="
javascript
:
void
(
0
);
">
No data found!</a>
</li>
</ul>
@endif
application/resources/views/frontend/searchs/city_dropdown.blade.php
View file @
b5b0ddbb
...
...
@@ -2,8 +2,7 @@
<option
value=
""
>
Select City
</option>
@if(!empty($getCityData))
@foreach($getCityData as $key => $option)
<option
value=
"
<?php
echo
$option
;
?>
"
>
<?php
echo
$option
;
?>
</option>
<option
value=
"
<?php
echo
$option
;
?>
"
>
<?php
echo
$option
;
?>
</option>
@endforeach
@endif
</select>
\ No newline at end of file
application/resources/views/frontend/searchs/detail.blade.php
View file @
b5b0ddbb
...
...
@@ -270,13 +270,13 @@
$
(
"#reviewElement"
).
on
(
'click'
,
'.pagination li a'
,
function
()
{
var
page
=
$
(
this
).
data
(
'page'
);
var
locatorID
=
$
(
'#locaterid'
).
val
();
review
p
aginate
(
page
,
locatorID
);
review
P
aginate
(
page
,
locatorID
);
});
function
review
p
aginate
(
page
,
locatorID
){
function
review
P
aginate
(
page
,
locatorID
){
$
.
ajax
({
type
:
'post'
,
url
:
"{{route('review
p
aginate')}}"
,
url
:
"{{route('review
P
aginate')}}"
,
data
:
{
"_token"
:
"{{ csrf_token() }}"
,
page
:
page
,
locatorID
:
locatorID
},
success
:
function
(
datanew
)
{
$
(
"#reviewElement"
).
html
(
datanew
);
...
...
application/resources/views/frontend/searchs/index.blade.php
View file @
b5b0ddbb
...
...
@@ -79,10 +79,7 @@
if
(
data
.
status
==
'success'
)
{
$
(
'#localitylist'
).
fadeIn
();
$
(
'#localitylist'
).
html
(
data
.
data
);
}
else
{
$
(
'#localitylist'
).
fadeIn
();
$
(
'#localitylist'
).
html
(
data
.
data
);
}
}
}
})
}
...
...
@@ -151,18 +148,9 @@
url
:
"{{route('searchlocater')}}"
,
data
:
{
"_token"
:
"{{ csrf_token() }}"
,
page
:
page
,
locality
:
locality
,
state
:
state
,
city
:
city
,
location
:
location
,
ratingOrder
:
ratingOrder
},
success
:
function
(
datanew
)
{
if
(
datanew
.
status
==
'success'
)
{
loader
();
$
(
'#searchlocaterid'
).
html
(
datanew
.
data
);
}
else
{
loader
();
$
(
'#searchlocaterid'
).
html
(
datanew
.
data
);
}
$
(
".locality"
).
val
(
locality
);
$
(
'.getStateValue option:selected'
).
attr
(
'state'
);
$
(
".getCityValue"
).
val
(
city
);
$
(
'.location'
).
val
(
location
);
loader
();
$
(
'#searchlocaterid'
).
html
(
datanew
.
data
);
}
});
}
...
...
@@ -176,11 +164,7 @@
url
:
"{{route('getCityValue')}}"
,
data
:
{
"_token"
:
"{{ csrf_token() }}"
,
state
:
state
},
success
:
function
(
datanew
)
{
if
(
datanew
.
status
==
'success'
)
{
$
(
'.cityData'
).
html
(
datanew
.
data
);
}
else
{
$
(
'.cityData'
).
html
(
datanew
.
data
);
}
$
(
'.cityData'
).
html
(
datanew
.
data
);
}
});
});
...
...
@@ -189,7 +173,7 @@
function
loader
(){
if
(
$
(
'.loader-outer-box'
).
length
)
{
$
(
'.loader-outer-box'
).
fadeIn
(
'slow'
,
function
()
{
setTimeout
(
function
(){
$
(
'.loader-outer-box'
).
fadeOut
(
'slow'
);
}
,
2000
);
setTimeout
(
function
(){
$
(
'.loader-outer-box'
).
fadeOut
(
'slow'
);
});
});
}
}
...
...
application/resources/views/frontend/searchs/review_element.blade.php
View file @
b5b0ddbb
@
if
(
!
empty
(
$reviewData
[
'data'
]))
<
div
class
="
col
-
12
card
-
columns
">
@foreach(
$reviewData['data']
as
$data
)
<article class="
card
">
...
...
@@ -70,4 +71,13 @@
<!-- End Pagination -->
</article>
@endif
</div>
\ No newline at end of file
</div>
@else
<div class="
col
-
12
card
-
columns
">
<article class="
card
">
<div class="
card
-
body
">
<p class="
rev
-
text
">No Data Found!</p>
</div>
</article>
</div>
@endif
\ No newline at end of file
application/routes/web.php
View file @
b5b0ddbb
...
...
@@ -19,13 +19,17 @@ Route::get('/', 'SearchController@index')->name('search');
Route
::
post
(
'searchlocater'
,
'SearchController@searchlocater'
)
->
name
(
'searchlocater'
);
Route
::
get
(
'autocomplete'
,
'SearchController@autocomplete'
)
->
name
(
'autocomplete'
);
Route
::
get
(
'detail/{slug}'
,
'SearchController@detail'
)
->
name
(
'detail'
);
Route
::
post
(
'review
paginate'
,
'SearchController@reviewpaginate'
)
->
name
(
'reviewp
aginate'
);
Route
::
post
(
'review
Paginate'
,
'SearchController@reviewPaginate'
)
->
name
(
'reviewP
aginate'
);
Route
::
post
(
'getCityValue'
,
'SearchController@getCityValue'
)
->
name
(
'getCityValue'
);
/* Cron Routes */
Route
::
get
(
'cron/getLocaterListData'
,
'CronController@getLocaterListData'
)
->
name
(
'getLocaterListData'
);
Route
::
get
(
'cron/getState'
,
'CronController@getState'
)
->
name
(
'getState'
);
Route
::
get
(
'cron/getCity'
,
'CronController@getCity'
)
->
name
(
'getCity'
);
Route
::
get
(
'404'
,[
'as'
=>
'404'
,
'uses'
=>
'ErrorHandlerController@errorCode404'
]);
Route
::
get
(
'405'
,[
'as'
=>
'405'
,
'uses'
=>
'ErrorHandlerController@errorCode405'
]);
/** End Cron Routes */
Auth
::
routes
();
...
...
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