for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of Gitamin.
*
* Copyright (C) 2015-2016 The Gitamin Team
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Gitamin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Tag extends Model
{
/**
* The attributes that should be casted to native types.
* @var string[]
protected $casts = [
'id' => 'int',
'name' => 'string',
];
* The fillable properties.
protected $fillable = ['name'];
* Overrides the models boot method.
public static function boot()
parent::boot();
self::creating(function ($tag) {
$tag->slug = Str::slug($tag->name);
});
}
* Tags can have many projects.
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
public function projects()
return $this->belongsToMany(Project::class);