Commit 887b6b5b by Arpit Jain

worked on feed section

parent 483cd5d2
......@@ -231,6 +231,22 @@ class FeedController extends AdminController
return view('admin.feeds.feed_setting');
}
public function updateShowFeed(Request $request){
if($request->showFeed == 'true'){
$show_feed = '1';
}else{
$show_feed = '0';
}
$updateShowFeed = LocaterFeed::where('locater_feeds.id', '=', $request->id)
->update(['show_feed' => $show_feed]);
return [
'status' => 'success',
'data' => 'done'
];
}
}
\ No newline at end of file
......@@ -84,7 +84,15 @@
<td>{{$row->id}}</td>
<td>{{$row->feeds_id}}</td>
<td>{{$row->title}}</td>
<td><input type="checkbox" data-id=feed_data_<?php echo $row->feeds_id; ?> style="width: 20px;height: 20px;" name="show"> </td>
<td>
<?php
if($row->show_feed == 1){
$checked = "checked";
}else{
$checked = "";
} ?>
<input <?php echo $checked; ?> type="checkbox" class="showFeed" data-id=<?php echo $row->id; ?> style="width: 20px;height: 20px;" name="show">
</td>
<td>{{date("F j, Y", strtotime($row->created_at))}}</td>
<td style="width:10%">
<a href="{{route('admin.feeds.edit',['id'=>$row->id])}}" class="btn btn-info btn-xs action-btn" title ="Edit"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
......@@ -117,4 +125,28 @@
</div>
</div>
<script type="text/javascript">
$(".showFeed").on('click', function () {
var id = $(this).data('id');
var showFeed = $(this).is(":checked");
showFeedData(id,showFeed);
});
function showFeedData(id,showFeed){
$.ajax({
type: 'POST',
url: "{{route('admin.feeds.updateShowFeed')}}",
data: {"_token": "{{ csrf_token() }}",id:id,showFeed:showFeed},
success: function (datanew) {
}
});
}
</script>
@endsection
......@@ -102,6 +102,8 @@ Route::group(['middleware' => ['auth'], 'prefix' => 'admin', 'namespace' => 'Adm
Route::post('feeds/{id}/edit', 'FeedController@updateFeed')->name('admin.feeds.update');
Route::get('feeds/{id}/delete', 'FeedController@deleteFeed')->name('admin.feeds.delete');
Route::get('feedSetting', 'FeedController@feedSetting')->name('admin.feedSetting');
Route::get('feedSetting', 'FeedController@feedSetting')->name('admin.feeds.feedSetting');
Route::post('updateShowFeed', 'FeedController@updateShowFeed')->name('admin.feeds.updateShowFeed');
});
......@@ -4,4 +4,6 @@ RUN on browser : WWW_ROOT./cron/getLocaterListData
RUN on browser : WWW_ROOT./cron/getState
RUN on browser : WWW_ROOT./cron/getCity
ALTER TABLE `homepages` CHANGE `other_setting` `show_feed` VARCHAR(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
\ No newline at end of file
ALTER TABLE `homepages` CHANGE `other_setting` `show_feed` VARCHAR(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
ALTER TABLE `locater_feeds` ADD `show_feed` TINYINT(4) NOT NULL DEFAULT '0' AFTER `id`;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment