Change sluggable implementation

This commit is contained in:
Jonny Barnes 2017-06-13 19:17:55 +01:00
parent e409cf68f9
commit 522f06162e
7 changed files with 285 additions and 58 deletions

View file

@ -4,18 +4,13 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
use League\CommonMark\CommonMarkConverter;
use MartinBean\Database\Eloquent\Sluggable;
use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\SoftDeletes;
class Article extends Model
{
use SoftDeletes;
/*
* We want to turn the titles into slugs
*/
use Sluggable;
const DISPLAY_NAME = 'title';
const SLUG = 'titleurl';
use SoftDeletes;
/**
* The attributes that should be mutated to dates.
@ -31,6 +26,20 @@ class Article extends Model
*/
protected $table = 'articles';
/**
* Return the sluggable configuration array for this model.
*
* @return array
*/
public function sluggable()
{
return [
'titleurl' => [
'source' => 'title'
]
];
}
/**
* Define the relationship with webmentions.
*

View file

@ -6,18 +6,13 @@ use DB;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Phaza\LaravelPostgis\Geometries\Point;
use MartinBean\Database\Eloquent\Sluggable;
use Cviebrock\EloquentSluggable\Sluggable;
use Phaza\LaravelPostgis\Eloquent\PostgisTrait;
class Place extends Model
{
use PostgisTrait;
/*
* We want to turn the names into slugs.
*/
use Sluggable;
const DISPLAY_NAME = 'name';
const SLUG = 'slug';
use PostgisTrait;
/**
* The attributes that are mass assignable.
@ -36,6 +31,20 @@ class Place extends Model
'polygon',
];
/**
* Return the sluggable configuration array for this model.
*
* @return array
*/
public function sluggable()
{
return [
'slug' => [
'source' => 'name'
]
];
}
/**
* Define the relationship with Notes.
*