mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
add profile Edit and delete my ads
This commit is contained in:
parent
932ea5e893
commit
a8c160b94f
@ -24,4 +24,6 @@ return [
|
||||
],
|
||||
'update_category_info' => 'Please update category.',
|
||||
'filter_by_search_msg' => 'Filter By Search.',
|
||||
'delete_author_error' => 'You cannot delete a post that does not belong to you',
|
||||
'success_delete' => 'Ad Deleted',
|
||||
];
|
||||
|
||||
@ -24,4 +24,6 @@ return [
|
||||
],
|
||||
'update_category_info' => 'Lütfen kategoriyi güncelleyiniz.',
|
||||
'filter_by_search_msg' => 'Aramanızı Daraltın.',
|
||||
'delete_author_error' => 'Size ait olmayan bir ilanı silemezsiniz',
|
||||
'success_delete' => 'İlan Silindi',
|
||||
];
|
||||
|
||||
@ -149,8 +149,6 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
'advs/my_advs' => 'Visiosoft\AdvsModule\Http\Controller\advsController@myAdvs',
|
||||
'advs/my_advs/{params}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@myAdvs',
|
||||
'advs/edit_advs/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@edit',
|
||||
'advs/delete_adv/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@destroy',
|
||||
|
||||
'advs/status/{id},{type}' => [
|
||||
'as' => 'visiosoft.module.advs::status',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@statusAds'
|
||||
@ -166,7 +164,10 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
],
|
||||
'mapJson' => 'Visiosoft\AdvsModule\Http\Controller\advsController@mapJson',
|
||||
'advs/ttr/{id}' => 'Visiosoft\PackagesModule\Http\Controller\packageFEController@advsStatusbyUser',
|
||||
'advs/delete/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@softDeleteAdv',
|
||||
'advs/delete/{id}' => [
|
||||
'as' => 'advs::delete',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@deleteAd',
|
||||
],
|
||||
'check_user' => 'Visiosoft\AdvsModule\Http\Controller\advsController@checkUser',
|
||||
'keySearch' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@keySearch',
|
||||
'adv/addCart/{id}' => [
|
||||
|
||||
@ -339,12 +339,19 @@ class AdvsController extends PublicController
|
||||
return $location;
|
||||
}
|
||||
|
||||
public function softDeleteAdv(AdvRepositoryInterface $advs, $id)
|
||||
public function deleteAd(AdvRepositoryInterface $advs, $id)
|
||||
{
|
||||
$ad = $this->adv_model->find($id);
|
||||
if (!Auth::user()) {
|
||||
redirect('/login?redirect=' . url()->current())->send();
|
||||
}
|
||||
|
||||
if ($ad->created_by_id != Auth::id()) {
|
||||
$this->messages->error(trans('visiosoft.module.advs::message.delete_author_error'));
|
||||
}
|
||||
|
||||
$advs->softDeleteAdv($id);
|
||||
$this->messages->error(trans('visiosoft.module.advs::message.success_delete'));
|
||||
return back();
|
||||
}
|
||||
|
||||
@ -703,18 +710,6 @@ class AdvsController extends PublicController
|
||||
return $this->view->make('visiosoft.module.advs::new-ad/new-create', compact('id', 'cats_d', 'request', 'Cloudinary', 'cities', 'adv', 'custom_fields'));
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
|
||||
$advs = AdvsAdvsEntryModel::find($id);
|
||||
if ($advs->id == auth()->user()->id) {
|
||||
return redirect('/advs/my_advs')->with('success', 'Basariyla Silindi');
|
||||
} else {
|
||||
return "Kendinizin olmayan bir ilani silmeye calisiyorsunuz.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function statusAds($id, $type, SettingRepositoryInterface $settings, Dispatcher $events)
|
||||
{
|
||||
$ad = $this->adv_model->getAdv($id);
|
||||
|
||||
@ -74,6 +74,17 @@ function dropdownRow(id, type) {
|
||||
passive +
|
||||
"</a>\n";
|
||||
}
|
||||
|
||||
dropdown += "<a class='dropdown-item text-primary' href='/advs/edit_advs/" + id + "'>" +
|
||||
"<i class='fas fa-pencil-alt'></i> " +
|
||||
edit_ad +
|
||||
"</a>\n";
|
||||
|
||||
dropdown += "<a class='dropdown-item text-danger' href='/advs/delete/" + id + "'>" +
|
||||
"<i class='fas fa-trash'></i> " +
|
||||
delete_ad +
|
||||
"</a>\n";
|
||||
|
||||
dropdown += "</div></div>";
|
||||
return dropdown;
|
||||
|
||||
|
||||
@ -6,4 +6,6 @@ return [
|
||||
'show' => 'Show Adress',
|
||||
'update_password' => 'Update Password',
|
||||
'update_profile' => 'Update Profile',
|
||||
'delete' => 'Delete',
|
||||
'edit' => 'Edit',
|
||||
];
|
||||
|
||||
@ -6,4 +6,6 @@ return [
|
||||
'show' => 'Göster',
|
||||
'update_password' => 'Update Password',
|
||||
'update_profile' => 'Update Profile',
|
||||
'delete' => 'Sil',
|
||||
'edit' => 'Düzenle',
|
||||
];
|
||||
|
||||
@ -51,6 +51,8 @@
|
||||
<script>
|
||||
var approve = "{{ trans('visiosoft.module.advs::field.approve') }}";
|
||||
var passive = "{{ trans('visiosoft.module.advs::field.passive') }}";
|
||||
var delete_ad = "{{ trans('visiosoft.module.profile::button.delete') }}";
|
||||
var edit_ad = "{{ trans('visiosoft.module.profile::button.edit') }}";
|
||||
</script>
|
||||
{{ asset_add('scripts.js','visiosoft.module.profile::assets/js/ads.js') }}
|
||||
{% endblock %}
|
||||
Loading…
Reference in New Issue
Block a user