SubSubCategory.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Database\Eloquent\Builder;
  5. /**
  6. * App\Models\SubSubCategory
  7. *
  8. * @property int $id
  9. * @property int $sub_category_id
  10. * @property string $name
  11. * @property string $brands
  12. * @property \Illuminate\Support\Carbon $created_at
  13. * @property \Illuminate\Support\Carbon $updated_at
  14. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory newModelQuery()
  15. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory newQuery()
  16. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory query()
  17. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereBrands($value)
  18. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereCreatedAt($value)
  19. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereId($value)
  20. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereName($value)
  21. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereSubCategoryId($value)
  22. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereUpdatedAt($value)
  23. * @mixin \Eloquent
  24. */
  25. class SubSubCategory extends Model
  26. {
  27. protected static function boot()
  28. {
  29. parent::boot();
  30. static::addGlobalScope('alphabetical', function (Builder $builder) {
  31. $builder->orderBy('name', 'asc');
  32. });
  33. }
  34. public function subCategory()
  35. {
  36. return $this->belongsTo(SubCategory::class);
  37. }
  38. }