We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In controller:
$input = Input::all(); $this->model->fill($input)->save()
In model:
public static function boot() { parent::boot(); static::saving(function($model) { return $model->arbitraryFunction(); }); }
When I try to use this method, no slug is generated. Specifically, the return causes the failure. Confirmed by commenting like so:
public static function boot() { parent::boot(); static::saving(function($model) { // return $model->arbitraryFunction(); }); }
This causes the slugs to be generated again.
The text was updated successfully, but these errors were encountered:
Perhaps this may be important: Let's say my model relationships are as follows:
<?php class Fruit extends Eloquent { public function boot() { parent::boot(); static::saving(function($model) { return $model->arbitraryFunction(); }); } public function arbitraryFunction() { // do stuff } // .... } ?>
And the model which has the sluggable behaviour:
<?php use Cviebrock\EloquentSluggable\SluggableInterface; use Cviebrock\EloquentSluggable\SluggableTrait; class Orange extends Fruit implements SluggableInterface { use SluggableTrait; protected $sluggable = [ 'build_from' => 'name', 'save_to' => 'slug' ]; // ..... }
Edit: Whoops, didn't mean to close the issue.
Sorry, something went wrong.
Okay the obvious fix was to only return the false if the function returned false.
Glad you figured this all out without me. ;)
No branches or pull requests
In controller:
In model:
When I try to use this method, no slug is generated. Specifically, the return causes the failure. Confirmed by commenting like so:
In model:
This causes the slugs to be generated again.
The text was updated successfully, but these errors were encountered: