# Introduction

This document has been prepared to inform software developers who develop web projects.

### For which projects can it be used?
It can be	used for projects such as blog, e-commerce, corporate, personal, portfolio, etc. It can be used for all projects that can be created with a template.

### How does the project work?
Websites are generally used for blogging, displaying galleries, and listing products. In addition, they typically include standard pages such as about us, contact, and privacy policy. That's why we thought we could create these by establishing a fixed backend structure like WordPress. When you create a new site, all you have to do is create the site to be added in the folder where our templates are located. You can find the codes you need for the frontend in the document.

!>Remember that any changes made in the backend or routes will affect all templates!

## Folder Structure

```
├── app
│   ├── Http
│   │   ├── Helpers
│   │   │   ├── AdminMenu.php
│   │   │   ├── Api.php
│   │   │   ├── Common.php
│   │   │   ├── Document.php
│   │   │   ├── General.php
│   │   │   ├── Languages.php
│   │   │   ├── Site.php
├── resources
│   ├── views
│   │   ├── admin
│   │   ├── front

```

1. **Helpers**

	- **app/Http/Helpers/AdminMenu.php**

		- This file contains the admin menu.

	- **app/Http/Helpers/Api.php**

		- This file contains the api functions.It is the helper file that was used in the past, but there are still actively used themes.

	- ~~**app/Http/Helpers/Common.php**~~

		- This file contains the common functions. It is the helper file that was used in the past, but there are still actively used themes.

	- **app/Http/Helpers/Document.php**

		- It is the actively used helper file. It is the most current one. It is the helper file that was used in the past, but there are still actively used themes.

	- ~~**app/Http/Helpers/General.php**~~

		- This file contains the general functions. It is the helper file that was used in the past, but there are still actively used themes.

	- ~~**app/Http/Helpers/Languages.php**~~

		- This file contains the language functions. It is the helper file that was used in the past, but there are still actively used themes.

	- ~~**app/Http/Helpers/Site.php**~~

		- This file contains the site functions. It is the helper file that was used in the past, but there are still actively used themes.

2. **Views**
	- **resources/views/admin**

		- This folder contains the admin panel files.

	- **resources/views/front**

		- This folder contains the template folders.


## Adaptation

<!-- ### How to add a new template?

1. Create a new folder in the **resources/views/front** folder. -->


### How can I get template views?
You can retrieve the views of the templates you have created by using the `Common::view()` function in the controller. Meanwhile, the `get_view()` function operates within the view.

For example, you have a template named blog and you want to create the `blog.blade.php` page by extending the `index.blade.php` page from it.

##### Step 1: Create a index.blade.php file in the blog/pages folder
```php
<!-- index.blade.php -->
<html>
<head>
	<title>Blog</title>
</head>
<body>
	@yield('content')
</body>
</html>
```

##### Step 2: Create a blog.blade.php file in the blog/pages folder
```php
<!-- blog.blade.php -->
@extends(get_view('pages.index'))
@section('content')
	<!-- content -->
	<h1>Blog</h1>
	@include(get_view('pages.xxx'))
@endsection
```

##### Step 3: Create a controller file

!> This is just an example. There is already a controller that will display the blog page. If you need to show a view on the new controller you will add, you can use it this way.

```php
// app/Http/Controllers/Front/BlogController.php
return Common::view('pages.blog');
```

##### Folder Structure
```
├── app
│   ├── Http
│   │   ├── Controllers
│   │   │   ├── Front
│   │   │   │   ├── BlogController.php
├── resources
│   ├── views
│   │   ├── front
│   │   │   ├── blog
│   │   │   │   ├── pages
│   │   │   │   │   ├── index.blade.php
│   │   │   │   │   ├── blog.blade.php
```


### How do I write code faster?

You can write code faster with the snippets we created using the vscode code editor.

Just run this magic command:

```bash
php artisan app:setup-dev
```
?> snippet files are in the .vscode/setup folder. If you run this command, it will replace the localhost URL you used during the development phase with __DOC_URL__, allowing you to access the document link when you get stuck.

Now you are ready! To use snippets, just type "web" in any view file in vscode.