php artisan make:controller is not defined - laravel

I am using Laravel Framework 6.20.44, which I can tell from php artisan -V
It comes part of OctoberCMS, which I just updated.
I'm jealous because the documentation for Laravel 6.x, and some many other resources, show that php artisan come with a make command, derived into so many subcommands.
I would like to enjoy a command like php artisan make:controller API/TopicController --api.
I can't, because my version of artisan returns:
Command "make:controller" is not defined.
Did you mean one of these?
create:controller
make:migration
It looks like I have an older version of artisan, heavily coupled to October.
I say coupled because I can spot commands such as october: when I list available artisan commands.
No luck with create:controller either, as --api is not implemented in my version...
My question: how do I update artisan so that I have access to the make command, according to the doco?

October CMS is developed in Laravel and it's not framework. It is CMS.
So, being CMS it has to maintain its directory structure with predefined paths. CMS is driven by plugins and themes. So you can only add/modify plugins or theme files.
So now if you try to add a controller where do it will add? it cants add to its system files OR in app/controllers/. To prevent this the authors of CMS have removed/overrideLaravel native commands to avoid creating the unexpected directory structure or files in core folders.
So basically you need to follow CMS rules and its command to maintain the directory structure and file structure of CMS. It's important otherwise CMS will not work.
php artisan create:controller <Author>:<PluginName> <ControllerName>
this is the exact definition: Create the controller in this plugin by this name. So it can work with CMS core logic.
Check some tutorials to understand how October CMS works:
How to install OctoberCMS
themes
How to edit OctoberCMS
themes
How to install OctoberCMS
plugins
Essential Plugins for
OctoberCMS
If any doubts please comment.

Related

How to properly duplicate a Laravel project in the same computer? [duplicate]

I have a Laravel 5.3 project which was created 5 months ago, today I made a duplicate from the project and I made some changes into the code.
When I edit the views in a blade.php file my project which I edited showed me the last project view, I made a new route in the new laravel project and in the routes works well, but still shows the last project view.
It's funny because the js files works pretty well, but the view doens't work. for example, I edit the profile.blade.php file and it shows the content from the last project, if I writte something new in the other view from the last project, it shows in the new project.
Any ideas?
Thanks in advance.
Your views/routes are compiled/cached.
The storage directory contains your compiled Blade templates, file
based sessions, file caches, and other files generated by the
framework.
The bootstrap directory contains files that bootstrap the framework
and configure autoloading. This directory also houses a cache
directory which contains framework generated files for performance
optimization such as the route and services cache files.
Run these commands
php artisan view:clear - Clear all compiled view
php artisan optimize --force - Optimize the framework for better performance
php artisan config:cache - Create a cache file for faster configuration loading
php artisan route:cache - Create a route cache file for faster route registration
Disable opcache from php.ini or use:
ini_set('opcache.enable', 0);

How to specify folder for laravel migrations?

I am trying to put laravel database migrations in sub folders, but not sure how to do this.
When creating new migrations and executing your migrations, you can pass in a path parameter through the command line interface to specify the directory it will use to create and run the migrations respectively.
php artisan make:migration create_users_table --path=/path/to/your/migration/directory
php artisan migrate --path=/path/to/your/migration/directory
In AppServiceProvider, find a boot method and add there following
$mainPath = database_path('migrations');
$directories = glob($mainPath . '/*' , GLOB_ONLYDIR);
$paths = array_merge([$mainPath], $directories);
$this->loadMigrationsFrom($paths);
Now you can use php artisan migrate and also php artisan migrate:back when having migrations in sub folders
If you eager to do this, here is a quick solution at nscreed/laravel-migration-paths
pakcage. Very simple and easy to use.
During the periodical development phase the migrations folder may become very large. It is very helpful if we can organize the content of the migration folders. This library helps to organize migration files in different folders. Even, if your organize your existing files it will works as well.
Hope, it will help you.
You might want to take a look at this package, it's not exactly what you are looking for but it is an alternative to sorting and organizing sections of your application including controller, migrations, models, views and others.
Nwidart's Laravel Modules for modular application development with Laravel,
It helps to organize your application into modules, and so, you can create migrations in each module, and since the modules are in separate folders it helps fix this issue someway.

Laravel automated view generation from models

In Laravel, I can create models and controllers automatically from the command line using
artisan
However, There is no command to generate views automatically based on the the model for CRUD operations. Wonder if there is a tool that would make this out of the box. I imagine this:
php artisan make:view model
and then I have all my views ready. I tried to search online but could not find a proper tool: LarvelCodeGenerator, and others...
Have you taken a look at Laravel View Generator.

What is the most direct way to push a site update to Laravel?

I've SSH into the server and into the Laravel folder. I updated one of the html footer files but the changes aren't reflected on the website. I feel like I probably need to recompile something.
I tried deleting and re-creating the .env file (I backed it up first).
I've tried running the following commands:
php artisan clear-compiled
php artisan optimize
php artisan cache:clear
The only way I can seem to update the site is by updating the main.min.js file, located at /laravel/public/assets/js/main.min.js which is a terrible way to update the site.
How do I force Laravel to recreate this file or recompile the site based on changes I made to html template files within the site?
What am I missing here? I don't have any Laravel experience and am trying to update this site for a client.
edit:
I think I need to clarify a bit more...
The site appears to be rendered from this file: /public/assets/js/main.min.js
Most of the site's homepage, for example, is located in this js file. But the file is minified and therefore unwieldy to edit directly.
I am assuming (and I could be completely wrong here) that the file is generated from the html files located in the Laravel folder. To support this notion, I have found html files in other directories that correspond to the html located in the main.min.js file.
My assumption is that the previous developer would update the html files and then run something to compile the site into javascript files. But maybe this has nothing to do with Laravel, per se, and more to do with some frontend framework?
Try clearing the cached views...
php artisan view:clear
Laravel assets reside in
resources/assets/js
of your root directory you can have look their
if your file main.js is build using laravel mix have a on webpack.mix.js which compiles all your files you can get idea from that. make sure to run
npm run prod
if you change any file
Hope this helps?

Clean Laravel To Bake New Project

I just did a fresh install of Laravel v5.5.25. I want to create a brand new project so I want to clear out some files in Laravel. For example, I want to delete all readymade templates (welcome page too), delete bootstrap from Laravel, etc. I just want to do ultimate start. So, will you please guide me what else should I delete too to make it a skeleton? And please tell me how can I remove bootstrap completely and replace it with Bulma.
You can run:
php artisan preset none
to remove default preset.
There is no Bulma preset of of the box, available options are:
none
bootstrap
vue
react
You can use Laravel Presets for that. If you want a “skeleton” as you said you should use php artisan preset none. There is also one for Bulma: composer require laravel-frontend-presets/bulma and then php artisan preset bulma.

Resources