mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
completed fast payment
This commit is contained in:
parent
fb710111cb
commit
1108dd7f12
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user