deiucanta / laravel-smart

Automatic Migrations, Validation and More
48 stars 7 forks source link

Error: guarded() not working as expected #11

Closed robsontenorio closed 6 years ago

robsontenorio commented 6 years ago

ProductController.php

class ProductController extends Controller
{
    public function store(Request $request)
    {
        $product = new Product();
        return $product->fill($request->all())->doSomething();
    }
}

Product.php

            Field::make('id')->increments(),
            Field::make('status_id')->unsignedInteger()->guarded(),
            // many others in here ...

I just want guard 'status_id', but i got an error ...

Add [status_id] to fillable property to allow mass assignment on [App\\Product]

But if guarded is declared as default way works fine

protected $guarded = ['status'];