![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mcoil.corals.io/app/Shop/CustomProducts/ |
<?php namespace App\Shop\CustomProducts; use App\Shop\Businesses\Business; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Collection; use Nicolaslopezj\Searchable\SearchableTrait; class CustomProduct extends Model { use SearchableTrait, SoftDeletes; /** * Searchable rules. * * @var array */ protected $searchable = [ 'columns' => [ 'custom_products.name' => 10, 'custom_products.description' => 5 ] ]; protected $table = 'custom_products'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'sku', 'name', 'description', 'note', 'rrp_price', 'edit_price', 'cost_price', 'image', 'business_id', 'price_type_id' ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = []; /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function business() { return $this->belongsTo(Business::class); } /** * @param string $term * @return Collection */ public function searchCustomProduct(string $term) : Collection { return self::search($term)->get(); } }