mirror of https://github.com/movim/movim
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
625 B
27 lines
625 B
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Tag extends Model
|
|
{
|
|
protected $fillable = ['name'];
|
|
|
|
public static function firstOrCreateSafe(array $attributes, array $values = [])
|
|
{
|
|
try {
|
|
return static::firstOrCreate($attributes, $values);
|
|
} catch (\PDOException $e) {
|
|
/*
|
|
* When an article is received the related tags can be saved
|
|
* simultaneously by different processes in the DB
|
|
*/
|
|
}
|
|
}
|
|
|
|
public function posts()
|
|
{
|
|
return $this->belongsToMany('App\Post')->withTimestamps();
|
|
}
|
|
}
|