bosnadev / repository

Laravel Repositories is a package for Laravel 5 which is used to abstract the database layer. This makes applications much easier to maintain.
https://bosnadev.com
825 stars 235 forks source link

How to create a model through repository #41

Closed xcaptain closed 9 years ago

xcaptain commented 9 years ago

I don't want to use massive assignment, so the default create method doesn't work for me.

I tried to use the traditional way to save a model, but I can't assign attributes to a model because model is protected.

$this->post->model->title = 'test'
$this->post->model->save();

just throw an error.

xcaptain commented 9 years ago

@mirzap How about add a method saveModel()? I can work on it.

mirzap commented 9 years ago

Please make a new PR, without composer.json changes (you can add your self as contributor, but don't remove my name)

xcaptain commented 9 years ago

commited again, hope it can be merged.