mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #844 from openclassify/vedatakdogan
Added Address Functions & move require & added currency symbol
This commit is contained in:
commit
a7abd95ee9
@ -13,6 +13,7 @@
|
||||
"wirelab/language_switcher-plugin": "^1.3",
|
||||
"visiosoft/addblock-extension": "^1.1",
|
||||
"ext-zip": "*",
|
||||
"chumper/zipper": "^1.0"
|
||||
"chumper/zipper": "^1.0",
|
||||
"sentry/sentry-laravel": "*"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,30 +1,41 @@
|
||||
<?php namespace Visiosoft\ProfileModule\Adress;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Visiosoft\LocationModule\City\Contract\CityRepositoryInterface;
|
||||
use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface;
|
||||
use Visiosoft\ProfileModule\Adress\Contract\AdressInterface;
|
||||
use Anomaly\Streams\Platform\Model\Profile\ProfileAdressEntryModel;
|
||||
|
||||
class AdressModel extends ProfileAdressEntryModel implements AdressInterface
|
||||
{
|
||||
public function getAdress($id = null) {
|
||||
if($id == null)
|
||||
{
|
||||
public function getAdress($id = null)
|
||||
{
|
||||
if ($id == null) {
|
||||
return AdressModel::query();
|
||||
}
|
||||
return AdressModel::query()->where('id',$id)->whereNull('deleted_at');
|
||||
return AdressModel::query()->where('id', $id)->whereNull('deleted_at');
|
||||
}
|
||||
|
||||
public function getAdressFirst($id) {
|
||||
public function getAdressFirst($id)
|
||||
{
|
||||
return $this->getAdress($id)->first();
|
||||
}
|
||||
|
||||
public function getUserAdress($id = null)
|
||||
{
|
||||
if ($id != null) {
|
||||
return $this->query()->where('user_id',$id)->whereNull('deleted_at')->get();
|
||||
return $this->query()->where('user_id', $id)->whereNull('deleted_at')->get();
|
||||
}
|
||||
return $this->query()->where('user_id', Auth::id())->whereNull('deleted_at')->get();
|
||||
}
|
||||
|
||||
public function getCountry()
|
||||
{
|
||||
return app(CountryRepositoryInterface::class)->find($this->country_id);
|
||||
}
|
||||
|
||||
public function getCity()
|
||||
{
|
||||
return app(CityRepositoryInterface::class)->find($this->city);
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,4 +27,18 @@ class AdressRepository extends EntryRepository implements AdressRepositoryInterf
|
||||
{
|
||||
return $this->newQuery()->where('user_id', $user_id)->get();
|
||||
}
|
||||
|
||||
public function createAddress($name, $user_id, $first_name, $last_name, $country_id, $city_id, $content, $gsm_phone)
|
||||
{
|
||||
return $this->create([
|
||||
'adress_name' => $name,
|
||||
'user_id' => $user_id,
|
||||
'adress_first_name' => $first_name,
|
||||
'adress_last_name' => $last_name,
|
||||
'country_id' => $country_id,
|
||||
'city' => $city_id,
|
||||
'adress_content' => $content,
|
||||
'adress_gsm_phone' => $gsm_phone,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
||||
|
||||
interface AdressInterface extends EntryInterface
|
||||
{
|
||||
|
||||
public function getCountry();
|
||||
}
|
||||
|
||||
@ -5,4 +5,6 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
||||
interface AdressRepositoryInterface extends EntryRepositoryInterface
|
||||
{
|
||||
public function findByUser($user_id);
|
||||
|
||||
public function createAddress($name, $user_id, $first_name, $last_name, $country_id, $city_id, $content, $gsm_phone);
|
||||
}
|
||||
|
||||
@ -79,8 +79,7 @@
|
||||
"visiosoft/integer-field_type": "~2.1.0",
|
||||
"visiosoft/list-field_type": "*",
|
||||
"guzzlehttp/guzzle": "~6.3.3",
|
||||
"composer/composer": "^1.6",
|
||||
"sentry/sentry-laravel": "*"
|
||||
"composer/composer": "^1.6"
|
||||
},
|
||||
"replace": {
|
||||
"anomaly/streams-platform": "*"
|
||||
|
||||
@ -42,7 +42,7 @@ return [
|
||||
'USD' => [
|
||||
'name' => 'US Dollar',
|
||||
'direction' => 'ltr',
|
||||
'symbol' => '',
|
||||
'symbol' => '$',
|
||||
'separator' => '.',
|
||||
'point' => ',',
|
||||
'decimals' => 2,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user