From eb5be46875501240825ec6b129579514c0252e84 Mon Sep 17 00:00:00 2001 From: Yassir Awad Date: Tue, 1 Oct 2019 01:08:49 +0300 Subject: [PATCH] fixing --- composer.json | 1 - src/Models/Form.php | 23 +---------------------- src/Resources/Form.php | 4 ++-- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index f59ff3e..f5d671c 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,6 @@ "license": "MIT", "require": { "php": ">=7.1.0", - "spatie/laravel-sluggable": "^2.1", "benjaminhirsch/nova-slug-field": "^1.2", "laravel/nova": "^2.0" }, diff --git a/src/Models/Form.php b/src/Models/Form.php index 4aac5c4..63d3ad8 100644 --- a/src/Models/Form.php +++ b/src/Models/Form.php @@ -3,13 +3,10 @@ namespace MohRajab\NovaForms\Models; use Illuminate\Database\Eloquent\Model; -use Spatie\Sluggable\HasSlug; -use Spatie\Sluggable\SlugOptions; class Form extends Model { - use HasSlug; - protected $fillable = ['name', 'emails', 'inputs']; + protected $fillable = ['name', 'emails', 'inputs', 'slug']; protected $casts = [ 'inputs' => 'array' @@ -19,22 +16,4 @@ public function entries() { return $this->hasMany(FormEntry::class); } - - public function getSlugOptions(): SlugOptions - { - return SlugOptions::create() - ->generateSlugsFrom('name') - ->saveSlugsTo('slug') - ->doNotGenerateSlugsOnUpdate(); - } - - /** - * Get the route key for the model. - * - * @return string - */ - public function getRouteKeyName() - { - return 'slug'; - } } diff --git a/src/Resources/Form.php b/src/Resources/Form.php index 5a2f1aa..0969a68 100644 --- a/src/Resources/Form.php +++ b/src/Resources/Form.php @@ -27,7 +27,7 @@ class Form extends Resource */ public static $title = 'name'; - public static $displayInNavigation = false; + public static $displayInNavigation = false; /** * The columns that should be searched. @@ -54,7 +54,7 @@ public function fields(Request $request) ->slug('slug'), Slug::make('Slug') - ->disableAutoUpdateWhenUpdating(), + ->disableAutoUpdateWhenUpdating(), Text::make('Emails') ->help('add (,) as separator for multiple emails')