Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php cviebrock/Elount sluggable在遵循所有安装指南和重新安装时不起作用_Php_Laravel 5 - Fatal编程技术网

Php cviebrock/Elount sluggable在遵循所有安装指南和重新安装时不起作用

Php cviebrock/Elount sluggable在遵循所有安装指南和重新安装时不起作用,php,laravel-5,Php,Laravel 5,我在中遵循了安装指南 这是我的帖子模型结构: namespace App; use Cviebrock\EloquentSluggable\SluggableInterface; use Cviebrock\EloquentSluggable\SluggableTrait; use Illuminate\Database\Eloquent\Model; class Post extends Model implements SluggableInterface { use Slugga

我在中遵循了安装指南

这是我的帖子模型结构:

namespace App;
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
use Illuminate\Database\Eloquent\Model;

class Post extends Model implements SluggableInterface
{
    use SluggableTrait;
    protected $sluggable = [
        'build_from' => 'post_title',
        'save_to'    => 'post_alias',
        'unique'     => true
    ];

    protected $guarded    = ['hits', 'comments_count', 'created_at', 'updated_at'];
    protected $primaryKey = 'post_id';

    protected $dateFormat = 'U';

    public function post_pics ()
    {
        return $this->hasMany('App\PostPics');
    }

    public function categories ()
    {
        return $this->belongsToMany('App\Category', 'category_post', 'post_id', 'cat_id');
    }

    public function getCreatedAtAttribute($value){
        return $value;
    }
}
并在app.php文件中为服务提供商添加了适当的条目:

yajra\Datatables\DatatablesServiceProvider::class,
Spatie\Glide\GlideServiceProvider::class,
Illuminate\Html\HtmlServiceProvider::class,
Cviebrock\EloquentSluggable\SluggableServiceProvider::class,
但在向Post表插入新行时,Post\u别名字段为空:

$newPost = new Post(['post_title'=>'How are you']);
$newPost->save();
问题是什么?我如何解决

更新:

我正在使用Laravel框架版本5.1.23(LTS)。然而,当我在另一个基于5.1.19版的项目中使用这个包时,它工作得很好

在多次搜索和尝试尝试尝试和错误之后,首先删除包,然后在composer.json文件中的其他包之前插入“cviebrock/elount slaggable”:“dev master”,正好在“laravel/framework”:“5.1.*”之后

更新composer后,它工作正常。 我不知道为什么会发生这种情况