Last active
January 23, 2023 11:53
-
-
Save estudijoanpuig/fc1a562033cad71afe7da94a6e79969a to your computer and use it in GitHub Desktop.
model codes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Database\Eloquent\Builder; | |
use Illuminate\Database\Eloquent\Casts\Attribute; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Database\Eloquent\Model; | |
use Illuminate\Database\Eloquent\Relations\BelongsTo; | |
use Illuminate\Support\Facades\Storage; | |
class Code extends Model | |
{ | |
use HasFactory; | |
protected $perPage = (6); | |
protected $fillable = [ | |
'nom', | |
'slug', | |
'img', | |
'category_id', | |
'tag_id', | |
'descripcio', | |
'blockcode', | |
]; | |
protected $casts = [ | |
'id' => 'integer', | |
]; | |
public function category() | |
{ | |
return $this->belongsTo(Category::class, 'category_id'); | |
} | |
public function tag() | |
{ | |
return $this->belongsTo(Tag::class, 'tag_id'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment