PHP code example of rapidwebltd / improved-polymorphic-eloquent-builder
1. Go to this page and download the library: Download rapidwebltd/improved-polymorphic-eloquent-builder library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rapidwebltd / improved-polymorphic-eloquent-builder example snippets
class Variation extends \RapidWeb\ImprovedPolymorphicEloquentBuilder\Model
{
public function model()
{
return $this->morphTo();
}
}
Variation::whereHas('model', function($query) use ($brandId) {
$query->where('brand_id', 2);
}, '>=', 1, ['bags'])->get();