new to PHP and Filament, can backwards engineer the database i have?
Hi All,
i learn best when i dive in, im new to PHP, learning as i go. i've installed a new app with filamemt. i have a good idea what i want to make.
i have a sqlite DB already i was wondering if there is away to work backwords with this and generate the models from the database.
if this isnt possible is there away for me to generate the models from YAML files?
thanks in advance for any advice, im excited to start diving in :)
6 Replies
Since you’re new I’d focus on how laravel works first then add livewire and alpine to your knowledge base. Then focus on filament. But I know you can do it. Just need to figure it all out in the right order.
i have an ok grasp on how laravel works, what's pulled me in is the structure and how tidy it seems, Livewire im slowly getting there with this;
im working with specific data i want to display and there are allot of tables i dont want to have to write out the models for (over 40)
Understandable but that’s how it works.
The model is the interface between the db and the data. If you have 40 tables then you need 40 models.
Or at least a solid relationship between the models.
Not sure what this has to do with Filament though.
was curious if filament had a backwards engineering type plugin for the db, so it doesn't that's fine, sorry for inconveniencing you with my question i guess.
You could take a look at https://github.com/reliese/laravel to kickstart your model generation. In the end you just have to do the dirty work as not everything can be guessed from your schema. Casting, guards, fillables, tricky relations, etc.
GitHub
GitHub - reliese/laravel: Reliese Laravel Model Generator
Reliese Laravel Model Generator. Contribute to reliese/laravel development by creating an account on GitHub.
this is what i was looking for, thank you for the link, shame it's not working with L11 yet but hopfully soon