Skip to content
New issue

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

Reading from a custom path works, however when I try to add a field the POST to /schematics/models/edit #34

Open
mtolhuys opened this issue Mar 12, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@mtolhuys
Copy link
Owner

Reading from a custom path works, however when I try to add a field the POST to /schematics/models/edit
fails with Exception
"message": "Cannot replace non-existing $fillable",
when hitting the save button.

Drag & drop to sort the new field does not work (can't drop in the list of existing fields)

Originally posted by @cord in #28 (comment)

@mtolhuys mtolhuys added the bug Something isn't working label Mar 12, 2020
@mtolhuys mtolhuys modified the milestone: 0.10.0 Mar 12, 2020
@mtolhuys
Copy link
Owner Author

@cord Model creation was still focused on app_path() so models would be stored there based on the namespace. This caused some weird behavior.

I solved this by adding a 'path' key to 'models' in the config. It will store models specified in the path there. You'll find this in 0.10.2. If you're still experiencing issues I'm curious about the model and it's location. Maybe it's a situation I didn't test yet.

Drag & drop to sort the new field does not work (can't drop in the list of existing fields)

This is due to the fact that it's not (yet) supported to change columns order in migrations through the package.

@cord
Copy link

cord commented Mar 13, 2020

Just updated:
- Updating mtolhuys/laravel-schematics (0.10.1 => 0.10.2): Downloading (100%)

Then trying this:

Laravel Schematics 2020-03-13 09-02-55

leads to an error bar at the bottom "unprocessable entity" and the response still shows
"message": "Cannot replace non-existing $fillable",

Btw. great package towards a nice roundtrip engineer tool! Currently, I use https://laravelsd.com and https://novapackages.com/packages/cloudstudio/resource-generator which have same nice details you might want to check.

@mtolhuys
Copy link
Owner Author

Hi @cord !

Could you maybe share how the class file looks like? Is it's path {app}/csm? I'm having trouble reproducing it. Are you perhaps on Windows as well?

Thanks! Aim is to have a rocksolid tool at v1.0. Interesting shares, I'll look into them!

@mtolhuys mtolhuys reopened this Mar 13, 2020
@cord
Copy link

cord commented Mar 13, 2020

looks like this - extended from a custom Model class

<?php

namespace Csm;

class Alert extends Model
{
    protected $table = 'alerts';
    public $timestamps = true;

    public function alertRules()
    {
        return $this->belongsToMany('Csm\AlertRule');
    }

    public function alertSubscribers()
    {
        return $this->belongsToMany('Csm\AlertSubscriber');
    }

    public function alertNotifications()
    {
        return $this->hasMany('Csm\AlertNotification');
    }

    public function alertable()
    {
        return $this->morphTo();
    }

   // some more custom functions...)
}


@mtolhuys
Copy link
Owner Author

Ah, I see. There is no $fillable. I'll see what I can do about that this evening (since I'm at work right now).

@AsjidAle
Copy link

AsjidAle commented Mar 4, 2024

The issue is that you have not made the change in the ORM model to be fillable in the field where you're trying to insert the value to make this work add the following line

protected $fillable = [];

In the array, place the column names in which you're going to store the value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants