Where do I put non-Eloquent models in a Laravel project?
I want to add a model for TextComponent, which is only used within Laravel and doesn't have a database equivalent (so not extending Eloquent\Model).
Where would I put such model files to keep them separate from all the Eloquent stuff?
Yes, you should separate non-Eloquent models for better organization.
If TextComponent represents a domain concept consider placing it inside a subfolder within app/Models, such as app/Models/Domain or app/Models/ValueObjects (design pattern in DDD). If it is view-related, you can use app/ViewModels. If it's a utility, consider app/Support.
@EveAT Thank you! TextComponent is supposed to be a model that contains fields like text, font size, font family, coords, etc. I'm passing it to non-view-related methods such as FFmpegVideo->addText(TextComponent $t).
So I suppose app/Models/Domain is what I should be going with, correct?
Your Class TextComponent seems more like a helper class which you will be using in other classes.
You should make use of Traits. It would give you better control and separation of logic.
@AqeelUrRahman My helper classes usually just contain a bunch of static utility methods. In this case I want to build a structured object that doesn't contain logic. I'm not sure how Traits would help with that. Could you elaborate?
You are right. If it contains only structure. You can have it in the separate folder which can be anywhere inside app folder,
if you are going for domain driven development,
then one domain will contain all the repository, controller, helper, services, request in it.
e.g.
app/UserDomain/User.php
app/UserDomain/UserController.php
app/UserDomain/UserService.php