Laravel Basic Directory Structure

C:\wamp\www\blog2\database\migrations : contains the Database Migration (Table strucutre)

 

C:\wamp\www\blog2\routes : contains the routing, mainly in the file WEB.php. This is where the system decides which Route file to load depending on the URL entered by the user.

Route::get(‘/users’, ‘UsersController@Index’);
Route::get(‘/users/{user_id}’, ‘UsersController@Show’);

C:\wamp\www\blog2\app\Http\Controllers: the above routes will bring the system to this directory where it will load files based on the controller name. for example: UsersController will load UsersController.php in the directory.

@Show, @Index is referring to the function within the controller.

C:\wamp\www\blog2\resources\views : contains the VIEW file of the website . Create subdirectory for paths like users/index OR users.index , users/show OR users.show. This is loaded by the controller file.

public function Index() {
$users = User::get();

return view(‘users.index’, compact(‘users’) );

}

C:\wamp\www\blog2\app : contains the App (Record/table class/representation in the system). Overriding the primarykey is done here.

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *