# FuzyonLazer Admin Panel - Setup Guide

## Prerequisites

Before setting up the application, ensure you have the following installed:

- PHP 8.2 or higher
- MySQL 5.7 or higher
- Composer
- Node.js and NPM
- Git

## Installation Steps

### 1. Clone the Repository

```bash
git clone <repository-url>
cd fuzyonlazer
```

### 2. Install PHP Dependencies

```bash
composer install
```

### 3. Install Node Dependencies

```bash
npm install
```

### 4. Configure Environment Variables

Copy the example environment file and configure your settings:

```bash
cp .env.example .env
```

Edit the `.env` file and update the database configuration:

```env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=fuzyonlazer
DB_USERNAME=your_mysql_username
DB_PASSWORD=your_mysql_password
```

### 5. Generate Application Key

```bash
php artisan key:generate
```

### 6. Set Up the Database

Run the setup command to create the database tables and seed initial data:

```bash
php artisan app:setup
```

This command will:

- Run all migrations
- Seed the database with an initial super admin user

The default admin credentials are:

- Email: admin@example.com
- Password: password

### 7. Compile Assets

For development:

```bash
npm run dev
```

For production:

```bash
npm run build
```

### 8. Start the Development Server

```bash
php artisan serve
```

The application will be available at `http://localhost:8000`

## Accessing the Admin Panel

Navigate to `http://localhost:8000/admin` and log in with the admin credentials.

## Application Structure

### User Roles

1. **Super Admin**
   - Can manage all content
   - Can create and manage other admin users
   - Has full access to all admin features

2. **Admin**
   - Can manage all content except other admin users
   - Cannot create or modify admin accounts

### Content Management

The admin panel allows you to manage:

1. **Home Page**
   - About Us section
   - Our Values section

2. **Services**
   - List of services with images
   - Each service has title and description in all 3 languages

3. **Files**
   - File uploads with titles in all 3 languages
   - Supports any file type

4. **Sectors**
   - Business sectors with images
   - Each sector has title and description in all 3 languages

5. **Contact**
   - Company address in all 3 languages
   - Phone number
   - Email address
   - Map embed code

### Language Management

The application supports 3 languages:

- Turkish (tr)
- English (en)
- German (de)

All content can be entered separately for each language.

## Adding New Admin Users

Only Super Admins can add new admin users:

1. Log in as a Super Admin
2. Navigate to the "Admins" section in the sidebar
3. Click "Add Admin"
4. Fill in the user details and select the role
5. Save the new admin user

## Changing Password

To change your password:

1. Navigate to the "Edit Admin" page for your user
2. Enter a new password in the password fields
3. Save the changes

## Development

### Adding New Languages

To add a new language:

1. Add the language code to the locale validation in `routes/web.php`
2. Create a new directory in `lang/` with the language code
3. Create a `messages.php` file in the new directory with translations
4. Update the language switcher in the admin layout

### Adding New Content Types

To add a new content type:

1. Create a new model with translatable fields using Spatie Translatable
2. Create a migration for the new content type
3. Create a controller for managing the content
4. Add routes in `routes/web.php`
5. Create views for listing, creating, and editing content
6. Add navigation link in the admin layout

## Troubleshooting

### Database Connection Issues

If you encounter database connection issues:

1. Ensure MySQL is running
2. Verify database credentials in `.env`
3. Check if the database exists (create it if needed)

### Missing Assets

If CSS/JS assets are not loading:

1. Run `npm install` to install dependencies
2. Run `npm run dev` or `npm run build` to compile assets

### Migration Errors

If you encounter migration errors:

1. Run `php artisan migrate:fresh` to reset the database
2. Run `php artisan app:setup` to set up the application again

## Support

For support, contact the development team or refer to the Laravel documentation.
