# Developer Guide

## Directory Structure

<figure><img src="https://1030029444-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FruOScZYB7ObNWqlN9ETi%2Fuploads%2FbSkfbONsFnBtiaLfjADB%2FScreenshot%202022-10-19%20112529.png?alt=media&#x26;token=c9f4014d-19e3-4012-8cf4-5fabce2d4528" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
&#x20;**Note:** The above image is just a screen snap of my project folder, below I have explained the project skeleton in brief.
{% endhint %}

```
Easy Ticket
    ├── app/  ->It contains all the backend code of our web application like Controllers,Providers,Middlewares etc.
    ├── bootstrap/ ->This directory contains app.php from where the whole framework bootstraps.
    ├── config/ ->This directory contains all the configuration files related to database, mail, session, services etc.
    ├── database/ ->This directory contains database migrations, model factories and seeds.
    ├── Modules/ ->This directory will contain all Modules which is used to build appplication    
    ├   ├─ Agent/ -> This module is responsible for managing agent
    ├      ├─ Config/
    ├      ├─ Console/
    ├      ├─ Database/
    ├      ├─ Entities/
    ├      ├─ Http/
    ├      ├─ Providers/  
    ├      ├─ Resources/  
    ├      ├─ Routes/     
    ├      ├─ Tests/     
    ├      ├─ vendor/       
    ├   ├─ AssignPermissions/ -> This Module manage the permission part
    ├   ├─ Cms/ ->This module create dynamic pages
    ├   ├─ Configurations/ ->This module is responsible for handling configuration settings
    ├   ├─ Customer/ ->This module manage customer, creation,updation and listing
    ├   ├─ Dashboard/  ->This module manage the dashboard data
    ├   ├─ Department/ ->This module is responsible for managing department
    ├   ├─ Faq/ ->This module is responsible for managing faq.
    ├   ├─ Knowledgebase/ ->This module is responsible for creating knowledgebase
    ├   ├─ Language/ ->This module is responsible for adding multiple language to your application
    ├   ├─ Permission/ ->This module is responsible for managing permission
    ├   ├─ Profile/ ->This module is responsible for managing logged in user profile
    ├   ├─ Role/  ->This module is responsible for managing role
    ├   ├─ TicketFields/ ->This module is responsible for creating dynamic fields
    ├── public/ ->This directory contains assets used in the application like images, javaScript and, css.
    ├── resources/ ->This directory contains the front end of the application.
    ├── routes/ ->This directory contains all the route definitions of the application.
    ├── storage/ ->This directory contains the compiled Blade templates, file caches, and other files generated by framework.
    ├── tests/ ->This directory contains all of our automated tests files.
    ├── vendor/ ->This directory contains all the dependencies downloaded through Composer needed by our framework.
```

## App Folder

This folder contains another subfolder, like **console, exception, exports, Http, Imports, Models, Permissions, Providers**.

* Console - Files under this folder are responsible for managing commands.
* Exception - Files under this folder contain the core exception logic, you can also add your's or modify the existing exception handling logic.
* Exports - Files under this folder are responsible for managing maatwebsite exports.
* Http - This folder contains several sub-folder as controller and middleware, the controller is responsible for managing business logic, and middleware acts as a middleman between request and response.&#x20;
* Imports - Files under this folder are responsible for managing maatwebsite imports.
* Models - Files under this folder are responsible for the database transaction.
* Permissions - Files under this folder contain permission-related logic.
* &#x20;Providers - Files under this folder contain your application service provider logic, here you can add your broadcast or new route logic.

## Bootstrap

The `bootstrap` directory contains the `app.php` file which bootstraps the framework. This directory also houses a `cache` directory which contains framework generated files for performance optimization such as the route and services cache files. You should not typically need to modify any files within this directory.

## Config

The `config` directory, as the name implies, contains all of your application's configuration files. It's a great idea to read through all of these files and familiarize yourself with all of the options available to you.

## Database

The `database` directory contains your database migrations, model factories, and seeds. If you wish, you may also use this directory to hold an SQLite database.

## Modules

This folder has many subfolder such as **Attendance, configuration, dashboard, Employees, Holidays, Notice, Payroll, Priority, Profile, Project, Rewards, Roles, Tasks, Vacation**.Let me explain each directory one by one.

{% hint style="info" %}
**Good to know:** We have used nwidart laravel modules packages, so all the folders under module, will contain the following folder config, console, database, entities, http, providers, resources, routes, tests, vendor. So I will explain the only one module subfolder because the working principle is the same for others also.
{% endhint %}

* Config - It contains a file named as config returns module name, you can add other data also inside the defined array.
* Console - you can create your own console method by using this command **php artisan test** **module:make-command**&#x20;
* Database - It contains migration, factory and seeder related files.
* Entities - It contains files that manage your database tranasction.
* http - This folder contains several sub-folder as controller and middleware, the controller is responsible for managing business logic, and middleware acts as a middleman between request and response.&#x20;
* Providers - Files under this folder contain your application service provider logic, here you can add your broadcast or new route logic.
* Resources - The `resources` directory contains your views as well as your raw, un-compiled assets such as CSS or JavaScript. This directory also houses all of your language files.
* Routes - The `routes` directory contains all of the route definitions for your application. By default, several route files are included with Laravel: `web.php`, `api.php`
* Test - The `tests` directory contains your automated tests. Example [PHPUnit](https://phpunit.de/) unit tests and feature tests are provided out of the box. Each test class should be suffixed with the word `Test`.
* Vendor - The `vendor` directory contains your Composer dependencies.

## How to create own module

You can use the below command to create your custom module and add controller, migration seeder to it.

{% hint style="info" %}
**Note:** I am using the customer name as my new module name.
{% endhint %}

### Create a module

```
php artisan module:make customer
```

### Create a model

```
php artisan module:make-model Customer Customers
```

### Create model and migration together

```
php artisan module:make-model Customer -m Customers
```

### Create Controller

```
php artisan module:make-controller CustomersController Customer
```

### Create Seeder

```
php artisan module:make-seed StatesTableSeeder Customers
```

### Delete the module

```
php artisan module:delete Customer
```

## Customize the theme

If you want to add customize the theme, then go to the following path **resources/views/admin/layouts,** here you will find the following files alert.blade.php, app.blade.php, breadcumb.blade.php, footer.blade.php, header.blade.php, sidebar.blade.php. Let me explain to you each and every file respectively.

* alert.blade.php - here default alert message code is defined.
* app.blade.php - this is the base of the theme file, as it is extended everywhere in the blade file.
* breadcumb.blade.php - responsible for generating dynamic breadcumb.
* footer.blade.php - contain footer-related code, you can modify the footer from here.
* header.blade.php - contain the header-related code, you can modify header from here.
* sidebar - contain sidebar-related code, you can modify sidebar from here.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://code-hunger.gitbook.io/easy-ticket/project-customization/developer-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
