Sodalis
Moving everything in /app to /something_else
I made a subclass of Laravel's ServiceProvider which appears to do the job, however I also just discovered
spatie/laravel-package-tools
which does exactly what I managed to achieve only better, so I will look at switching to that.23 replies
Moving everything in /app to /something_else
Definitely hard coded (or at least I didn't find out where it wasn't hard coded). But I did make it work (so far at least) - I created a directory for a module (Base) containing an App sub-directory which has the App namespace and a database sub directory for the Database namespaces. I then subclassed the Laravel ServiceProvider class and added code to do all the stuff packages do to register directories (avoiding registering directories that match locations that are already the ones I defined in my bootstrap/app.php. But I certainly worry that this will come back and bite me later.
23 replies
Moving everything in /app to /something_else
I have made most of the necessary changes. Just a few tweaks to make sure that the default paths are correct and that I have added override paths where needed in the ServiceProviders for App and my application core module. Then I can see if it loads.
23 replies
Moving everything in /app to /something_else
I guess I am going to have to put things back and then decide how to generate code for inline testing in a different namespace and generate production code that will be run in a different instance using the App namespace.
23 replies
Moving everything in /app to /something_else
Hmm - it turns out that App\Models\User is hard coded in various places in filament, fortify, jetstream and maybe eloquent. In which case it seems to be impossible to switch away from the App namespace, and quite possibly from /app too.
23 replies
Moving everything in /app to /something_else
The only problem with the (same) approach above that we both identified, is that there may still be parts of Livewire or Filament or some other package that still refer to Laravel's "resourcePath()" method, and then we might have some difficulties.
23 replies
Moving everything in /app to /something_else
Yes - that is indeed my plan on my next coding session (later this evening). Having established the structure and got it working, my next steps are to define welcome, registration and login screens and to establish the main UI (Filament panels), persistent/session storage, application settings and then start on the first module.
23 replies
Moving everything in /app to /something_else
I have actually successfully managed to change the namespace and location of /app to something else.
/app/*, /config, /routes and /test are now successfully in /myproject/core, /bootstrap in /myproject and I plan to create modules /myproject/module1 etc. with their own sets of subdirectories. I had to change .env, artisan, composer.json, public/index.php and mainly /bootstrap/app.php to make the change of directories work.
I also (obviously) had to edit all the files from /app to change the namespace from App* to MyProject\Core*, but that was easy with a global edit.
The only thing I haven't yet been able to do is to move the resources directory and to create separate sources for each module. This is primarily because unlike the App, Bootstrap, Config, Database, Lang, Public, Storage and Environment locations each of which has a
$app-> useXXXPath($path)
method, there is no such method for resources which has to be a fixed resources
subdirectory of the base path. However I think from a pure Laravel code perspective, this only needs to contain the Views
sub-directory structure, with the css and js subdirectories being referred to from e.g. vite and tailwind configuration files. And I think I should be able to define in the ServiceProvider for each module a location for the Views for that module (including core).23 replies
Moving everything in /app to /something_else
It took a few hours experimentation but I seem to have managed to achieve this for the welcome page at least. Literally all the base folders except resources (and public and storage which I want to remain where they are) are now in a different subdirectory.
23 replies