mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 23:06:08 -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.',
|
'update_category_info' => 'Please update category.',
|
||||||
'filter_by_search_msg' => 'Filter By Search.',
|
'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.',
|
'update_category_info' => 'Lütfen kategoriyi güncelleyiniz.',
|
||||||
'filter_by_search_msg' => 'Aramanızı Daraltın.',
|
'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' => 'Visiosoft\AdvsModule\Http\Controller\advsController@myAdvs',
|
||||||
'advs/my_advs/{params}' => '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/edit_advs/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@edit',
|
||||||
'advs/delete_adv/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@destroy',
|
|
||||||
|
|
||||||
'advs/status/{id},{type}' => [
|
'advs/status/{id},{type}' => [
|
||||||
'as' => 'visiosoft.module.advs::status',
|
'as' => 'visiosoft.module.advs::status',
|
||||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@statusAds'
|
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@statusAds'
|
||||||
@ -166,7 +164,10 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
|||||||
],
|
],
|
||||||
'mapJson' => 'Visiosoft\AdvsModule\Http\Controller\advsController@mapJson',
|
'mapJson' => 'Visiosoft\AdvsModule\Http\Controller\advsController@mapJson',
|
||||||
'advs/ttr/{id}' => 'Visiosoft\PackagesModule\Http\Controller\packageFEController@advsStatusbyUser',
|
'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',
|
'check_user' => 'Visiosoft\AdvsModule\Http\Controller\advsController@checkUser',
|
||||||
'keySearch' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@keySearch',
|
'keySearch' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@keySearch',
|
||||||
'adv/addCart/{id}' => [
|
'adv/addCart/{id}' => [
|
||||||
|
|||||||
@ -339,12 +339,19 @@ class AdvsController extends PublicController
|
|||||||
return $location;
|
return $location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function softDeleteAdv(AdvRepositoryInterface $advs, $id)
|
public function deleteAd(AdvRepositoryInterface $advs, $id)
|
||||||
{
|
{
|
||||||
|
$ad = $this->adv_model->find($id);
|
||||||
if (!Auth::user()) {
|
if (!Auth::user()) {
|
||||||
redirect('/login?redirect=' . url()->current())->send();
|
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);
|
$advs->softDeleteAdv($id);
|
||||||
|
$this->messages->error(trans('visiosoft.module.advs::message.success_delete'));
|
||||||
return back();
|
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'));
|
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)
|
public function statusAds($id, $type, SettingRepositoryInterface $settings, Dispatcher $events)
|
||||||
{
|
{
|
||||||
$ad = $this->adv_model->getAdv($id);
|
$ad = $this->adv_model->getAdv($id);
|
||||||
|
|||||||
@ -74,6 +74,17 @@ function dropdownRow(id, type) {
|
|||||||
passive +
|
passive +
|
||||||
"</a>\n";
|
"</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>";
|
dropdown += "</div></div>";
|
||||||
return dropdown;
|
return dropdown;
|
||||||
|
|
||||||
|
|||||||
@ -6,4 +6,6 @@ return [
|
|||||||
'show' => 'Show Adress',
|
'show' => 'Show Adress',
|
||||||
'update_password' => 'Update Password',
|
'update_password' => 'Update Password',
|
||||||
'update_profile' => 'Update Profile',
|
'update_profile' => 'Update Profile',
|
||||||
|
'delete' => 'Delete',
|
||||||
|
'edit' => 'Edit',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -6,4 +6,6 @@ return [
|
|||||||
'show' => 'Göster',
|
'show' => 'Göster',
|
||||||
'update_password' => 'Update Password',
|
'update_password' => 'Update Password',
|
||||||
'update_profile' => 'Update Profile',
|
'update_profile' => 'Update Profile',
|
||||||
|
'delete' => 'Sil',
|
||||||
|
'edit' => 'Düzenle',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -51,6 +51,8 @@
|
|||||||
<script>
|
<script>
|
||||||
var approve = "{{ trans('visiosoft.module.advs::field.approve') }}";
|
var approve = "{{ trans('visiosoft.module.advs::field.approve') }}";
|
||||||
var passive = "{{ trans('visiosoft.module.advs::field.passive') }}";
|
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>
|
</script>
|
||||||
{{ asset_add('scripts.js','visiosoft.module.profile::assets/js/ads.js') }}
|
{{ asset_add('scripts.js','visiosoft.module.profile::assets/js/ads.js') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Loading…
Reference in New Issue
Block a user