Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| Size | |
0.00% |
0 / 5 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| purchase_details | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAll | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| findById | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Models; |
| 4 | |
| 5 | use App\Models\admin\PurchaseDetails; |
| 6 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 7 | use Illuminate\Database\Eloquent\Model; |
| 8 | |
| 9 | class Size extends Model |
| 10 | { |
| 11 | use HasFactory; |
| 12 | |
| 13 | protected $table = 'sizes'; |
| 14 | |
| 15 | protected $fillable = |
| 16 | [ |
| 17 | 'name', |
| 18 | 'slug', |
| 19 | 'thumbnail', |
| 20 | 'description', |
| 21 | 'created_by', |
| 22 | ]; |
| 23 | |
| 24 | public function purchase_details() |
| 25 | { |
| 26 | return $this->hasMany(PurchaseDetails::class); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * ########################################### |
| 31 | * # Repository Methods Start # |
| 32 | * ########################################### |
| 33 | * */ |
| 34 | public static function getAll($is_pluck = false) |
| 35 | { |
| 36 | $query = self::query(); |
| 37 | $query->latest(); |
| 38 | |
| 39 | return $is_pluck ? $query->pluck('name', 'id') : $query->cursor(); |
| 40 | } |
| 41 | |
| 42 | public static function findById($id) |
| 43 | { |
| 44 | |
| 45 | return self::query()->findOrFail($id); |
| 46 | } |
| 47 | /** |
| 48 | * ########################################### |
| 49 | * # Repository Methods END # |
| 50 | * ########################################### |
| 51 | * */ |
| 52 | } |