Examples of code I've written in PHP, Javascript, SCSS, etc.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. use App\Models\Order;
  6. use App\Models\Supplier;
  7. class Service extends Model
  8. {
  9. use HasFactory;
  10. protected $fillable = [
  11. 'name', 'type', 'site', 'available'
  12. ];
  13. public function order() {
  14. return $this->hasMany(Order::class);
  15. }
  16. public function suppliers() {
  17. return $this->hasMany(Supplier::class);
  18. }
  19. public function primary() {
  20. return $this->belongsTo(Supplier::class, 'primary_supplier', 'id');
  21. }
  22. }