mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
#4609 default country not working fast create
This commit is contained in:
parent
4cb72bf693
commit
30c1d170d7
@ -2,6 +2,8 @@
|
||||
|
||||
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||
use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface;
|
||||
use Visiosoft\LocationModule\Country\CountryModel;
|
||||
|
||||
class SimpleAdvFormHandler
|
||||
{
|
||||
@ -11,12 +13,14 @@ class SimpleAdvFormHandler
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$builder->getFormValue('created_by_id')) {
|
||||
$builder->setFormValue('created_by_id', auth()->id());
|
||||
}
|
||||
|
||||
$builder->saveForm();
|
||||
|
||||
if (!$builder->getFormValue('country_id')) {
|
||||
$entry = $builder->getFormEntry();
|
||||
$entry->setAttribute('country_id', setting_value('visiosoft.module.location::default_country'));
|
||||
$entry->save();
|
||||
}
|
||||
|
||||
$ad = $advRepository->find($builder->getFormEntryId());
|
||||
if (!$builder->getFormValue('status') && $ad->status !== 'approved') {
|
||||
$ad->approve();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user