completed fast payment

This commit is contained in:
vedatakdogan 2020-12-01 11:37:37 +03:00
parent fb710111cb
commit 1108dd7f12
4 changed files with 34 additions and 7 deletions

View File

@ -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);
}
}

View File

@ -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,
]);
}
}

View File

@ -4,5 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
interface AdressInterface extends EntryInterface
{
public function getCountry();
}

View File

@ -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);
}