#4196 (evdepismis.com) natto-theme

This commit is contained in:
diashalabi 2021-08-18 10:05:22 +03:00
parent 0ac25d3d6e
commit c0cffa72b1
7 changed files with 75 additions and 0 deletions

View File

@ -11,6 +11,7 @@ use Visiosoft\AdvsModule\Adv\Contract\AdvInterface;
use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
use Visiosoft\AdvsModule\Support\Command\Currency;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
use Visiosoft\LocationModule\City\CityModel;
use Visiosoft\LocationModule\Country\CountryModel;
use Visiosoft\CartsModule\Cart\Command\GetCart;
@ -527,4 +528,19 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
ARRAY_FILTER_USE_KEY
);
}
public function lastCategory()
{
if (!$catsIDs = $this->getCatsIDs()) {
return null;
}
$lastCatID = end($catsIDs);
if (!$lastCat = app(CategoryRepositoryInterface::class)->find($lastCatID)) {
return null;
}
return $lastCat;
}
}

View File

@ -95,4 +95,6 @@ interface AdvInterface extends EntryInterface
public function canEdit();
public function getCatsIDs();
public function lastCategory();
}

View File

@ -0,0 +1,8 @@
<?php namespace Visiosoft\AdvsModule\Adv\Support\MultipleFieldType;
class LookupTableBuilder extends \Anomaly\MultipleFieldType\Table\LookupTableBuilder
{
protected $columns = [
'name',
];
}

View File

@ -0,0 +1,8 @@
<?php namespace Visiosoft\AdvsModule\Adv\Support\MultipleFieldType;
class SelectedTableBuilder extends \Anomaly\MultipleFieldType\Table\SelectedTableBuilder
{
protected $columns = [
'name',
];
}

View File

@ -0,0 +1,8 @@
<?php namespace Visiosoft\AdvsModule\Adv\Support\MultipleFieldType;
class ValueTableBuilder extends \Anomaly\MultipleFieldType\Table\ValueTableBuilder
{
protected $columns = [
'name',
];
}

View File

@ -0,0 +1,26 @@
<?php namespace Visiosoft\ProfileModule\Profile\Command;
use Anomaly\Streams\Platform\Image\Command\MakeImageInstance;
use Illuminate\Foundation\Bus\DispatchesJobs;
class GetProfilePhotoURL
{
use DispatchesJobs;
protected $user;
public function __construct($user)
{
$this->user = $user;
}
public function handle()
{
return $this->user->file ? $this->user->file->make()->url() : $this->dispatchNow(
new MakeImageInstance(
'visiosoft.module.profile::images/profile-default.png',
'img'
)
)->url();
}
}

View File

@ -4,6 +4,7 @@ use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
use Visiosoft\ProfileModule\Adress\Command\GetAddress;
use Visiosoft\ProfileModule\Adress\Command\GetAddressByUser;
use Visiosoft\ProfileModule\Profile\Command\GetProfileDetail;
use Visiosoft\ProfileModule\Profile\Command\GetProfilePhotoURL;
class ProfileModulePlugin extends Plugin
{
@ -43,6 +44,12 @@ class ProfileModulePlugin extends Plugin
return $ad;
}
),
new \Twig_SimpleFunction(
'profilePhoto',
function ($user) {
return $this->dispatch(new GetProfilePhotoURL($user));
}
),
];
}
}