Suppose that the project folder is C:\wamp\www\test_laravel
- Model name should start with big letter and singular noun. Ex: Student.php, Customer.php, ProductCategory.php (2 words)
- For its content, you have to create a class, and the class name should be the same to the filename. and it have to extends from Model.
- The screenshot above mean that model Customer represents customers table in the database. The table name should be lowercase and plural noun. Ex: customers, users, product_categories (2 words)
- Controller name have to be in this format CustomerController (name of controller start with big letter + Controller)
- For its content, you have to create a class, and the class name should be the same to the filename. and it have to extends from Controller
- And inside class, we have to create methods and those method name have to start with get or post. Ex: getIndex(), getDelete(), postCreateCustomer() (2 words). Note: get is used for get request. And post is used to post request.
Route is front door to allow access to the system. So you cannot access view and controller without route.
This is the format of route.
Route::get('URI','Action') // Action can be function or controller method
// route to view
// route to controller action
// route to controller
Route::controller('customer','CustomerController'); // by default, it will run getIndex() method
How to run it? Go to browser and type
http://localhost/test_laravel // it will point to route 1
http://localhost/test_laravel/customer_list // it will point to route 2
http://localhost/test_laravel/customer // it will point to route 3. And method getIndex() will execute