Skip to content

Commit

Permalink
Revisit the full slug saving flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofandel committed Nov 21, 2024
1 parent 53f59c3 commit 9521fd6
Show file tree
Hide file tree
Showing 21 changed files with 382 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class Page extends Model
'description',
];
public $slugAttributes = [
protected $slugFields = [
'title',
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Article extends Model implements LocalizedUrlRoutable
'description',
];

public $slugAttributes = [
protected $slugFields = [
'title',
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Article extends Model implements Sortable

// #endregion fillable

public $slugAttributes = [
private $slugFields = [
'title',
];

Expand Down
2 changes: 1 addition & 1 deletion examples/basic-page-builder/app/Models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Page extends Model
'description',
];

public $slugAttributes = [
protected $slugFields = [
'title',
];
}
2 changes: 1 addition & 1 deletion examples/portfolio/app/Models/Partner.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Partner extends Model
'description',
];

public $slugAttributes = [
protected $slugFields = [
'title',
];

Expand Down
2 changes: 1 addition & 1 deletion examples/portfolio/app/Models/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Project extends Model
'description',
];

public $slugAttributes = [
protected $slugFields = [
'title',
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Post extends Model implements Sortable

public $translatedAttributes = ['title', 'description'];

public $slugAttributes = ['title'];
public $slugFields = ['title'];

public $mediasParams = [
'cover' => [
Expand Down
2 changes: 1 addition & 1 deletion examples/tests-modules/app/Models/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Author extends Model implements Sortable
public $translatedAttributes = ['name', 'description', 'bio'];

// uncomment and modify this as needed if you use the HasSlug trait
public $slugAttributes = ['name'];
protected $slugFields = ['name'];

// add checkbox fields names here (published toggle is itself a checkbox)
public $checkboxes = ['published'];
Expand Down
2 changes: 1 addition & 1 deletion examples/tests-modules/app/Models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Category extends Model
public $translatedAttributes = ['title'];

// uncomment and modify this as needed if you use the HasSlug trait
public $slugAttributes = ['title'];
protected $slugFields = ['title'];

// add checkbox fields names here (published toggle is itself a checkbox)
public $checkboxes = ['published'];
Expand Down
2 changes: 1 addition & 1 deletion examples/tests-singleton/app/Models/ContactPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ContactPage extends Model
'description',
];

public $slugAttributes = [
protected $slugFields = [
'title',
];

Expand Down
2 changes: 1 addition & 1 deletion examples/tests-subdomain-routing/app/Models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Page extends Model implements Sortable
'description',
];

public $slugAttributes = [
public $slugFields = [
'title',
];

Expand Down
3 changes: 2 additions & 1 deletion src/Commands/stubs/model.stub
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class {{modelClassName}} extends Model {{modelImplements}}
'description',
];
{{/hasTranslation}}{{hasSlug}}
public $slugAttributes = [
protected $slugFields = [
'title',
];
protected $slugDeps = [];
{{/hasSlug}}
}
Loading

0 comments on commit 9521fd6

Please sign in to comment.