Edit your htaccess file. This alone will redirect your root o the public folder. If you have a lot inside of your htaccess file. Be careful while adding stuff. Ensure you keep a backup before editing and test the addition of the code inside the htaccess file.
class MyCustomClassName
{
public function __construct()
{
}
public function whatever_whatever(){
// Code goes here. And can use anything from the construct. The construct will always load first
}
}
A Controller or Class in MVC are both just classes. So... Technically speaking. It is possible to write all your functionality inside your controllers and completely ditch the classes folder. But! The purpose of breaking out into separate classes is re-usability.
Controllers :
<?php
namespace App\Http\Controllers;
class MyCustomController extends Controller
{
}
Classes :
<?php
namespace App\Classes\MyCustomClass;
class ClassNameWhateverWhatever
{
}
Why Classes, what is the point? ----------------------------------------------------------------- Classes serve as containers for specific purposes. For example.
You create a class for : Car -- And inside your class you write all your functionality. A car can have specific functionality. -- moveForward() reverse() brake() switchOnLights() ----------------------------------------------------------------- Then, you reference your car class inside your contollers. -- So something like car->moveForward();
This design strategy makes your code extremely easy to re-use without having to re-write additional functionality. This is why we seperate everything into a class and then we create another class called a controller class and reference our classes inside the controller classes.
//Update your packages:
sudo apt-get update
//Install Curl to get the composer library:
sudo apt-get install curl
//Installing composer:
sudo curl -s https://getcomposer.org/installer | php
//Move the composer file to bin path :
sudo mv composer.phar /usr/local/bin/composer
//Verify composer installation :
composer
Install NPM (Ubuntu Terminal cd ~)
sudo apt install npm
Activate WSL 2 and Virtual Machine Platform (Run as Admin in powershell ~)
NB!!! Don't forget to install the kernel for wsl2 : https://docs.microsoft.com/en-za/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
//Enable the WSL2 without reboot
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
//Enable the Virtual Machine Platform
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart