tighten / parental

Use single table inheritance in your Laravel app
MIT License
1.36k stars 98 forks source link

What's the best way to add a fillable to a child Model? #48

Closed angristan closed 1 year ago

angristan commented 5 years ago

Let's say I have this:

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use \Tightenco\Parental\HasChildren;
    use Notifiable;

    protected $childTypes = [
        'teacher' => App\Teacher::class,
    ];

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'first_name', 'last_name', 'email', 'password', 'type'
    ];
}
namespace App;

use Illuminate\Database\Eloquent\Model;

class Teacher extends User
{
    use \Tightenco\Parental\HasParent;

    //
}

What would be the best way to add a school fillable to my Teacher model? Do I have to redefine the whole $fillable?

mattstauffer commented 1 year ago

Hey friends! The team at Tighten has taken Parental back over and we're re-opening the issue tracker, but to give us a clean slate, I'm going to close all old issues that remain from when Caleb closed the issue tracker in 2020. If this is still an outstanding concern with the latest version of Parental, please feel free to open a new issue referencing this one.

Thank you!