-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce74a5d
commit 7912799
Showing
7 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Contains the Channelable trait. | ||
* | ||
* @copyright Copyright (c) 2023 Vanilo UG | ||
* @author Attila Fulop | ||
* @license MIT | ||
* @since 2023-09-07 | ||
* | ||
*/ | ||
|
||
namespace Vanilo\Channel\Traits; | ||
|
||
use Illuminate\Database\Eloquent\Relations\MorphToMany; | ||
use Vanilo\Channel\Models\Channel; | ||
|
||
trait Channelable | ||
{ | ||
public function channels(): MorphToMany | ||
{ | ||
return $this->morphToMany(Channel::class, 'channelable'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Contains the Channel class. | ||
* | ||
* @copyright Copyright (c) 2023 Vanilo UG | ||
* @author Attila Fulop | ||
* @license MIT | ||
* @since 2023-09-07 | ||
* | ||
*/ | ||
|
||
namespace Vanilo\Foundation\Models; | ||
|
||
use Illuminate\Database\Eloquent\Relations\MorphToMany; | ||
use Vanilo\Category\Models\TaxonomyProxy; | ||
use Vanilo\Channel\Models\Channel as BaseChannel; | ||
use Vanilo\MasterProduct\Models\MasterProductProxy; | ||
use Vanilo\Payment\Models\PaymentMethodProxy; | ||
use Vanilo\Product\Models\ProductProxy; | ||
use Vanilo\Properties\Models\PropertyProxy; | ||
use Vanilo\Shipment\Models\ShippingMethodProxy; | ||
|
||
class Channel extends BaseChannel | ||
{ | ||
public function products(): MorphToMany | ||
{ | ||
return $this->morphToMany(ProductProxy::modelClass(), 'channelables'); | ||
} | ||
|
||
public function masterProducts(): MorphToMany | ||
{ | ||
return $this->morphToMany(MasterProductProxy::modelClass(), 'channelables'); | ||
} | ||
|
||
public function shippingMethods(): MorphToMany | ||
{ | ||
return $this->morphToMany(ShippingMethodProxy::modelClass(), 'channelables'); | ||
} | ||
|
||
public function paymentMethods(): MorphToMany | ||
{ | ||
return $this->morphToMany(PaymentMethodProxy::modelClass(), 'channelables'); | ||
} | ||
|
||
public function taxonomies(): MorphToMany | ||
{ | ||
return $this->morphToMany(TaxonomyProxy::modelClass(), 'channelables'); | ||
} | ||
|
||
public function properties(): MorphToMany | ||
{ | ||
return $this->morphToMany(PropertyProxy::modelClass(), 'channelables'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters