Commit 4ced8e9d by Amshar

add innitial project

parents
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[{compose,docker-compose}.{yml,yaml}]
indent_size = 4
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:8000
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
# PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
*.log
.DS_Store
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
/.codex
/.cursor/
/.idea
/.nova
/.phpunit.cache
/.vscode
/.zed
/auth.json
/node_modules
/public/build
/public/fonts-manifest.dev.json
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
_ide_helper.php
Homestead.json
Homestead.yaml
Thumbs.db
ignore-scripts=true
audit=true
<laravel-boost-guidelines>
# Laravel Application
This repository contains a Laravel application. Complete the following setup before working on the user's request.
## Prerequisites
Verify that PHP and Composer are available:
```sh
php -v
composer -V
```
If either command is unavailable, detect the user's operating system and install the prerequisites with the appropriate command:
macOS:
```sh
/bin/bash -c "$(curl -fsSL https://php.new/install/mac/8.5)"
```
Windows PowerShell:
```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://php.new/install/windows/8.5'))
```
Linux:
```sh
/bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.5)"
```
After installation, ask the user to restart their terminal. If the agent needs the restarted shell to continue, ask the user to reopen their terminal and rerun their original prompt.
## Agent Setup
Install Laravel Boost from the application root before making application changes:
```sh
composer require laravel/boost --dev
php artisan boost:install
```
Boost replaces these bootstrap instructions with guidelines tailored to the application. After installation, read `AGENTS.md` again and continue with the user's original request using the generated guidelines.
</laravel-boost-guidelines>
<laravel-boost-guidelines>
# Laravel Application
This repository contains a Laravel application. Complete the following setup before working on the user's request.
## Prerequisites
Verify that PHP and Composer are available:
```sh
php -v
composer -V
```
If either command is unavailable, detect the user's operating system and install the prerequisites with the appropriate command:
macOS:
```sh
/bin/bash -c "$(curl -fsSL https://php.new/install/mac/8.5)"
```
Windows PowerShell:
```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://php.new/install/windows/8.5'))
```
Linux:
```sh
/bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.5)"
```
After installation, ask the user to restart their terminal. If the agent needs the restarted shell to continue, ask the user to reopen their terminal and rerun their original prompt.
## Agent Setup
Install Laravel Boost from the application root before making application changes:
```sh
composer require laravel/boost --dev
php artisan boost:install
```
Boost replaces these bootstrap instructions with guidelines tailored to the application. After installation, read `AGENTS.md` again and continue with the user's original request using the generated guidelines.
</laravel-boost-guidelines>
# Mini Office
A learning project: a small office-administration app built with Laravel 13 (PHP 8.3+), Blade views and Bootstrap 5. The owner is learning Laravel, so the code is deliberately heavy with explanatory comments.
## Environment
- Runs locally under **Laragon** on Windows (`C:\laragon\www\mini-office`).
- Database is **MySQL** (`mini_office`, user `root`, no password) per `.env`. Note that `.env.example` still defaults to SQLite.
- Frontend is built with Vite. `resources/js/app.js` imports Bootstrap's CSS and JS; the layout loads only that entry via `@vite('resources/js/app.js')`. Tailwind is installed and configured in `vite.config.js` but isn't used by the views, so use Bootstrap classes.
## Commands
```sh
composer dev # run the dev server(s)
npm run dev # Vite dev server only
npm run build # production asset build
composer test # clear config and run PHPUnit
php artisan migrate # run migrations
php artisan db:seed # seed departments and positions
vendor/bin/pint # format PHP code
```
## Structure
- **Routes** (`routes/web.php`): static pages (`home`, `about`, `services`, `contact`) are grouped under `PageController`; CRUD modules use `Route::resource`.
- **Modules**: `Department` and `Position` share the same shape (`name`, `code` unique and max 10 chars, `description` nullable, `is_active` boolean) and each has a model, migration, factory, seeder, resource controller and `index`/`create`/`edit`/`show` views.
- **Views**: every page extends `layouts/app.blade.php` and fills `@section('title')` and `@section('content')`. The layout includes the `partials/` header, sidebar (`col-2`), flash messages and footer. `components/alert.blade.php` provides `<x-alert type="...">`. There is a custom `errors/404.blade.php`.
## Conventions
When you add a new CRUD module, follow the Department pattern:
- Validate inline with `$request->validate([...])`. On update, use `Rule::unique('table')->ignore($model)` for unique columns.
- Mass-assign through `$fillable`.
- `index` uses `orderBy('name')->paginate(10)`.
- After store or update, redirect to the `index` route with `->with('success', '...')`. After destroy, use `back()->with('success', '...')` so the user stays on the same pagination page.
- Delete forms use `@csrf`, `@method('DELETE')` and an `onsubmit` confirm.
- Add a link to the module in `partials/sidebar.blade.php` using `@class(['nav-link', 'active' => request()->routeIs('module.*')])`.
- Keep the existing teaching-style comments. Add similar plain-English explanations to new code unless asked not to.
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
In addition, [Laracasts](https://laracasts.com) contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
You can also watch bite-sized lessons with real-world projects on [Laravel Learn](https://laravel.com/learn), where you will be guided through building a Laravel application from scratch while learning PHP fundamentals.
## Agentic Development
Laravel's predictable structure and conventions make it ideal for AI coding agents like Claude Code, Cursor, and GitHub Copilot. Install [Laravel Boost](https://laravel.com/docs/ai) to supercharge your AI workflow:
```bash
composer require laravel/boost --dev
php artisan boost:install
```
Boost provides your agent 15+ tools and skills that help agents build Laravel applications while following best practices.
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}
<?php
namespace App\Http\Controllers;
use App\Models\Department;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule; // Used in public function update. Rule is a class that lives in the Illuminate\Validation folder. PHP doesn't automatically know where to find it unless you tell it with a use statement at the top of the file.
class DepartmentController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$departments = Department::orderBy('name')->paginate(10); // sorts departments alphabetically so the list looks organised and fetches only 10 rows per page.
return view('departments.index', compact('departments')); // passes the $departments variable to the view.
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('departments.create'); // displays empty form for the user to fill in
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$data = $request->validate([ // checks the submitted data against your rules. If anything fails, Laravel automatically redirects back to the form with error messages.
'name' => 'required|max:100', // name must be filled in and cannot exceed 100
'code' => 'required|max:10|unique:departments', // make sure no other row has the same code.
'description' => 'nullable|max:500', // 'nullable' means the description can be left empty and not exceed 500
'is_active' => 'boolean', // receives True or False
]);
Department::create($data); // saves the record. Only fields in your model's $fillable array are saved.
return redirect()->route('departments.index') // redicrect to department page
->with('success', 'Department created.'); // flashes a message to the session so the list page can show "Department created." in a green alert.
}
/**
* Display the specified resource.
*/
/*
When someone clicks the "View" button on the list page,
it takes them to a page that displays all the details
of that one department. This is the show method. It's
the simplest of the lot because it just receives the department
(thanks to route model binding) and passes it to a view.
No forms, no validation, just display.
*/
public function show(Department $department)
{
return view('departments.show', compact('department')); // To display one record in the database
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Department $department)
{
return view('departments.edit', compact('department'));
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Department $department)
{
$data = $request->validate([
'name' => 'required|max:100',
'code' => ['required', 'max:10', Rule::unique('departments')->ignore($department)], // When creating a department, the code must be unique across the whole table. But when editing, the department might keep its own code. Without ->ignore($department), saving Finance with code "FIN" would fail because "FIN" already exists in the table... on the very record you're editing. The ignore tells Laravel "yes FIN exists, but it belongs to this department, so that's fine."
'description' => 'nullable|max:500',
'is_active' => 'boolean',
]);
$department->update($data);
return redirect()->route('departments.index')
->with('success', 'Department updated.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Department $department)
{
$department->delete(); // Deelete the department chosen
return back()->with('success', 'Department deleted.'); // back() is used instead of redirect()->route(...) because the user might be deleting from page 3 of the list, and you want them to stay on page 3 rather than jumping back to page 1.
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PageController extends Controller
{
public function home()
{
return view('pages.home', [
'title' => 'Home',
]);
}
public function about()
{
return view('pages.about', [
'title' => 'About',
]);
}
public function services()
{
return view('pages.services', [
'title' => 'Our Services',
]);
}
public function contact()
{
return view('pages.contact', [
'title' => 'Contact',
]);
}
}
\ No newline at end of file
<?php
namespace App\Http\Controllers;
use Illuminate\Validation\Rule;
use App\Models\Position;
use Illuminate\Http\Request;
class PositionController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$positions = Position::orderBy('name')->paginate(10);
return view('positions.index', compact('positions'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('positions.create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$data = $request->validate([
'name' => 'required|max:100',
'code' => 'required|max:10|unique:positions',
'description' => 'nullable|max:500',
'is_active' => 'boolean',
]);
$data['is_active'] = $request->boolean('is_active');
Position::create($data);
return redirect()->route('positions.index')
->with('success', 'Position created.');
}
/**
* Display the specified resource.
*/
public function show(Position $position)
{
return view('positions.show', compact('position'));
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Position $position)
{
return view('positions.edit', compact('position'));
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Position $position)
{
$data = $request->validate([
'name' => 'required|max:100',
'code' => ['required', 'max:10', Rule::unique('positions')->ignore($position)],
'description' => 'nullable|max:500',
'is_active' => 'boolean',
]);
$data['is_active'] = $request->boolean('is_active');
$position->update($data);
return redirect()->route('positions.index')
->with('success', 'Position updated.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Position $position)
{
$position->delete();
return back()->with('success', 'Position deleted.');
}
}
<?php
namespace App\Models; //says this file lives in the app/Models folder.
use Illuminate\Database\Eloquent\Factories\HasFactory; // imports the HasFactory trait, which lets you call Department::factory() to generate fake data. Without this line, the factory connection wouldn't work.
use Illuminate\Database\Eloquent\Model; // imports Laravel's base Model class. This is what gives your Department all the built-in powers like find(), create(), update(), delete(), where(), and everything else you've been using in Tinker.
class Department extends Model // creates your Department class and inherits everything from Model. By convention, Laravel sees the name "Department" and automatically connects it to the departments table in MySQL.
{
use HasFactory; // activates the factory trait inside the class. The use at the top of the file imports it, this use inside the class actually turns it on.
protected $fillable = [ // is the guest list we talked about. When you call Department::create([...]) or $d->update([...]), Laravel checks each field name against this array. If it's listed here, it goes through. If not, Laravel throws the MassAssignmentException
'name',
'code',
'description',
'is_active',
];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Position extends Model
{
/** @use HasFactory<\Database\Factories\PositionFactory> */
use HasFactory;
protected $fillable = [ // Specify what columns can be filled and save to the database
'name',
'code',
'description',
'is_active',
];
}
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Hidden;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
#[Fillable(['name', 'email', 'password'])]
#[Hidden(['password', 'remember_token'])]
class User extends Authenticatable
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}
<?php
// It's where you tell Laravel about any global configuration that applies across your whole app.
namespace App\Providers;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Paginator::useBootstrapFive();
}
}
#!/usr/bin/env php
<?php
use Illuminate\Foundation\Application;
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
/** @var Application $app */
$app = require_once __DIR__.'/bootstrap/app.php';
$status = $app->handleCommand(new ArgvInput);
exit($status);
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Http\Request;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
//
})
->withExceptions(function (Exceptions $exceptions): void {
$exceptions->shouldRenderJsonWhen(
fn (Request $request) => $request->is('api/*') || $request->expectsJson(),
);
})->create();
<?php
use App\Providers\AppServiceProvider;
return [
AppServiceProvider::class,
];
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.3",
"laravel/framework": "^13.17",
"laravel/tinker": "^3.0"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.2.5",
"laravel/pao": "^1.0.6",
"laravel/pint": "^1.27",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"phpunit/phpunit": "^12.5.12"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"setup": [
"composer install",
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
"@php artisan key:generate",
"@php artisan migrate --force",
"npm install --ignore-scripts",
"npm run build"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"@php artisan dev"
],
"test": [
"@php artisan config:clear --ansi @no_additional_args",
"@php artisan test"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"pre-package-uninstall": [
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache", "array"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
];
<?php
use App\Models\User;
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the number of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_STORE', 'database'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "storage", "octane",
| "session", "failover", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/locks'),
],
'storage' => [
'driver' => 'storage',
'disk' => env('CACHE_STORAGE_DISK'),
'path' => env('CACHE_STORAGE_PATH', 'framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
'failover' => [
'driver' => 'failover',
'stores' => [
'database',
'array',
],
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
/*
|--------------------------------------------------------------------------
| Serializable Classes
|--------------------------------------------------------------------------
|
| This value determines the classes that can be unserialized from cache
| storage. By default, no PHP classes will be unserialized from your
| cache to prevent gadget chain attacks if your APP_KEY is leaked.
|
*/
'serializable_classes' => false,
];
<?php
use Illuminate\Support\Str;
use Pdo\Mysql;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
'transaction_mode' => 'DEFERRED',
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
Mysql::ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
Mysql::ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => env('DB_SSLMODE', 'prefer'),
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
'persistent' => env('REDIS_PERSISTENT', false),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "monthly", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'max_files' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'monthly' => [
'driver' => 'monthly',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'max_files' => 3,
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', env('APP_NAME', 'Laravel')),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'handler_with' => [
'stream' => 'php://stderr',
],
'formatter' => env('LOG_STDERR_FORMATTER'),
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
'retry_after' => 60,
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
'retry_after' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Laravel')),
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis",
| "deferred", "background", "failover", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
'deferred' => [
'driver' => 'deferred',
],
'background' => [
'driver' => 'background',
],
'failover' => [
'driver' => 'failover',
'connections' => [
'database',
'deferred',
],
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Resend, Postmark, AWS, and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'key' => env('POSTMARK_API_KEY'),
],
'resend' => [
'key' => env('RESEND_API_KEY'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "memcached",
| "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain without subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
/*
|--------------------------------------------------------------------------
| Session Serialization
|--------------------------------------------------------------------------
|
| This value controls the serialization strategy for session data, which
| is JSON by default. Setting this to "php" allows the storage of PHP
| objects in the session but can make an application vulnerable to
| "gadget chain" serialization attacks if the APP_KEY is leaked.
|
| Supported: "json", "php"
|
*/
'serialization' => 'json',
];
<?php
/*
A factory does the same thing for your database. Instead
of you manually typing 50 departments one by one into SQLyog
or through a form, the factory generates them for you with
realistic but fake data. You tell it "I need 50 departments"
and it creates 50 rows, each with a random name, a random code,
a random description, and a random active/inactive status.
You need this because when you build the Department list
page in Week 4, you want to see how it looks with a full
table of data, how pagination works with many rows, how the
search and sorting behave. Testing with just 2 or 3 rows won't
reveal real problems.
The factory doesn't insert anything into the database on its own.
It just knows how to generate one fake department. The seeder
(Step 5) is what actually tells it "go make 50 of those and
save them." So the factory is the recipe for fake data, and the
seeder is the person who says "cook it."
*/
namespace Database\Factories; // tells PHP where this file lives in the project structure, so Laravel can find it automatically when you call Department::factory().
use App\Models\Department;
use Illuminate\Database\Eloquent\Factories\Factory; // imports Laravel's base Factory class, which gives your factory all the built-in methods for generating fake data.
/**
* @extends Factory<Department>
*/
class DepartmentFactory extends Factory // your factory inherits all the tools from Laravel's Factory class.
{
public function definition(): array // is the method Laravel calls every time it needs to create one fake department. It returns an array where each key matches a column in your departments table
{
return [
'name' => fake()->unique()->company(), // generates a random company name. fake() is Laravel's shortcut to a library called Faker, which has hundreds of methods for generating realistic data.
'code' => fake()->unique()->bothify('D-###'), // reates a code following a pattern. Each # gets replaced with a random digit, so you get codes like "D-482" or "D-017". unique() again prevents duplicates
'description' => fake()->sentence(), // generates a random sentence like "The quick brown fox sat on the lazy dog." It's just filler text so the column isn't empty.
'is_active' => fake()->boolean(80), // generates either true or false. The 80 means 80% chance of being true. So out of 50 fake departments, roughly 40 would be active and 10 inactive.
];
}
}
<?php
namespace Database\Factories;
use App\Models\Position;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Position>
*/
class PositionFactory extends Factory
{
public function definition(): array
{
return [
'name' => fake()->unique()->jobTitle(),
'code' => fake()->unique()->bothify('P-###'),
'description' => fake()->sentence(),
'is_active' => fake()->boolean(80),
];
}
}
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends Factory<User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->bigInteger('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->bigInteger('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedSmallInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->string('connection');
$table->string('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
$table->index(['connection', 'queue', 'failed_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('departments', function (Blueprint $table) {
$table->id();
$table->string('name', 100);
$table->string('code', 10)->unique();
$table->text('description')->nullable();
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('departments');
}
};
/*
Here's what each column line does:
$table->id() creates an auto-incrementing ID column. Every new department gets the next number automatically (1, 2, 3...).
$table->string('name', 100) creates a text column that holds up to 100 characters. Like a department name: "Finance", "Human Resources".
$table->string('code', 10)->unique() is a short code like "FIN" or "HR". The unique() part means the database will reject any duplicate. No two departments can share the same code.
$table->text('description')->nullable() holds a longer text description. nullable() means this column can be left empty. Not every department needs a description.
$table->boolean('is_active')->default(true) is a true/false flag. New departments are active by default. You might deactivate one later instead of deleting it.
$table->timestamps() automatically adds created_at and updated_at columns. Laravel fills these in for you whenever a record is created or changed.
*/
\ No newline at end of file
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('positions', function (Blueprint $table) { // List all the columns here inside the schema
$table->id();
$table->string('name', 100);
$table->string('code', 10)->unique();
$table->text('description')->nullable();
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('positions');
}
};
<?php
/*
this file like a conductor in an orchestra. It doesn't play
any instruments itself, it just tells each seeder when to run.
$this->call([...]) takes a list of seeders and runs them in order.
Right now you only have one, but in later weeks when you add
Staff and Asset seeders, you'll add them to this list.
*/
namespace Database\Seeders; // tells PHP this file lives in the seeders folder.
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder; // imports Laravel's base Seeder class, which your DatabaseSeeder extends.
class DatabaseSeeder extends Seeder // makes this the master seeder. When you run php artisan migrate:fresh --seed or php artisan db:seed, Laravel looks for this file first.
{
public function run(): void
{
/*It takes an array of seeder classes and runs them one
by one in the order they're listed. Right now you have
just DepartmentSeeder::class, so it runs your DepartmentSeeder
which creates the 5 real departments and 50 fake ones.*/
$this->call([
DepartmentSeeder::class,
PositionSeeder::class,
]);
}
}
\ No newline at end of file
<?php
namespace Database\Seeders; // tells PHP this file lives in the seeders folder
use Illuminate\Database\Console\Seeds\WithoutModelEvents; // unused import
use Illuminate\Database\Seeder; // imports Laravel's base Seeder class that gives your seeder the tools it needs.
use App\Models\Department; // imports the Department model so you can use Department::create(...) and Department::factory() in this file.
class DepartmentSeeder extends Seeder // this class inherits from Laravel's Seeder.
{
public function run(): void // method Laravel calls when you tell it to seed the database
{
Department::create([ // insert one specific row into the departments table. You're spelling out exactly what goes in.
'name' => 'Finance',
'code' => 'FIN',
'description' => 'Handles budgets, payroll and accounting.',
'is_active' => true,
]);
Department::create([
'name' => 'Human Resources',
'code' => 'HR',
'description' => 'Manages hiring, staff welfare and training.',
'is_active' => true,
]);
Department::create([
'name' => 'Information Technology',
'code' => 'ICT',
'description' => 'Maintains systems, networks and software.',
'is_active' => true,
]);
Department::create([
'name' => 'Logistics',
'code' => 'LOG',
'description' => 'Handles inventory, shipping and deliveries.',
'is_active' => true,
]);
Department::create([
'name' => 'Marketing',
'code' => 'MKT',
'description' => 'Manages branding, campaigns and outreach.',
'is_active' => true,
]);
Department::factory()->count(50)->create();
/*
Department::factory() says "use the DepartmentFactory to generate fake data"
->count(50) says "I want 50 of them"
->create() says "save them all to the database"
*/
}
}
<?php
namespace Database\Seeders;
use App\Models\Position;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class PositionSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
{
Position::create(['name' => 'Manager', 'code' => 'MGR', 'description' => 'Department head']);
Position::create(['name' => 'Assistant Manager', 'code' => 'AMGR', 'description' => 'Deputy department head']);
Position::create(['name' => 'Senior Executive', 'code' => 'SEXE', 'description' => 'Senior-level staff']);
Position::create(['name' => 'Executive', 'code' => 'EXEC', 'description' => 'General staff']);
Position::create(['name' => 'Intern', 'code' => 'INTN', 'description' => 'Industrial trainee']);
Position::factory()->count(50)->create(); // Creating 50 fake records. So there will be 50 + 5(The above records) = 55 records
}
}
}
{
"$schema": "https://www.schemastore.org/package.json",
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"@tailwindcss/vite": "^4.0.0",
"concurrently": "^10.0.3",
"laravel-vite-plugin": "^3.1",
"tailwindcss": "^4.0.0",
"vite": "^8.0.0"
},
"optionalDependencies": {
"@laravel/multiplex": "^0.4.1"
},
"dependencies": {
"bootstrap": "^5.3.8"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="BROADCAST_CONNECTION" value="null"/>
<env name="CACHE_STORE" value="array"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="DB_URL" value=""/>
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="TELESCOPE_ENABLED" value="false"/>
<env name="NIGHTWATCH_ENABLED" value="false"/>
</php>
</phpunit>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Handle X-XSRF-Token Header
RewriteCond %{HTTP:x-xsrf-token} .
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
<?php
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';
// Bootstrap Laravel and handle the request...
/** @var Application $app */
$app = require_once __DIR__.'/../bootstrap/app.php';
$app->handleRequest(Request::capture());
User-agent: *
Disallow:
@import 'tailwindcss';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@theme {
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
}
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap';
\ No newline at end of file
@props(['type' => 'info'])
<div {{ $attributes->merge(['class' => "alert alert-$type"]) }}>
{{ $slot }}
</div>
{{--This is a structure that is used by flash.blade.php--}}
{{--
- @props(['type' => 'info']) — this declares that the component
accepts a type prop with a default value of info. If someone
uses <x-alert> without specifying a type, it defaults to info
(a blue alert). If they pass type="success", it becomes green
- $attributes->merge([...]) — this lets you pass extra HTML attributes
(like an extra class or an id) when using the component, and they get
merged in rather than overwritten
- "alert alert-$type" — the $type variable gets inserted into the class
name. So type="success" produces class="alert alert-success" (green),
type="danger" produces class="alert alert-danger" (red)
- {{ $slot }} — whatever you put between <x-alert> and </x-alert> lands here.
It's like the content hole, similar to @yield but for components
--}}
{{--
Using it:
Anywhere in your Blade files, you can now write:
<x-alert type="success">Saved.</x-alert>
This outputs a green alert box with "Saved." inside it. Or <x-alert type="danger">
Something went wrong.</x-alert> for a red one. The x- prefix is how Laravel
knows it's a blade component (That you will want to reuse multiple times in the future)
and not a html.
--}}
\ No newline at end of file
@extends('layouts.app') {{--This extends the layout from layouts/app--}}
@section('title', 'Add Department') {{--Adding the tab name as "Add Department". Pass it to head in app.blade.php--}}
@section('content') {{--To fill in @yield content in layouts/app.blade.php--}}
<h1>Add Department</h1>
<form method="POST" action="{{ route('departments.store') }}"> {{--The form sends data using POST (because you're creating something new)--}}
@csrf {{--adds a hidden security token. Without it, Laravel rejects the form with a 419 error. It's like a security stamp that proves the form came from your own site--}}
<div class="mb-3">
<label for="name" class="form-label">Name</label> {{--tells the user what the field is for.--}}
<input type="text" name="name" id="name"
class="form-control @error('name') is-invalid @enderror"
value="{{ old('name') }}">
@error('name') {{--handles error if there's an invalid input--}}
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3">
<label for="code" class="form-label">Code</label> {{--tells the user what the field is for.--}}
<input type="text" name="code" id="code"
class="form-control @error('code') is-invalid @enderror"
value="{{ old('code') }}">
@error('code')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3">
<label for="description" class="form-label">Description</label>
<textarea name="description" id="description" rows="3"
class="form-control @error('description') is-invalid @enderror">{{ old('description') }}</textarea>
@error('description')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3 form-check">
<input type="checkbox" name="is_active" id="is_active"
class="form-check-input" value="1"
{{ old('is_active', true) ? 'checked' : '' }}>
<label for="is_active" class="form-check-label">Active</label>
</div> {{--checkbox. When checked, it sends value="1". When unchecked, it sends nothing at all.--}}
{{--Cancel is a link styled as a grey button that takes the user back to the list page without saving anything. Save is an actual submit button that sends the form data to the store method.--}}
<a href="{{ route('departments.index') }}" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-primary">Save</button>
</form>
@endsection
\ No newline at end of file
@extends('layouts.app') {{--This extends the layout from layouts/app--}}
@section('title', 'Edit Department') {{--Adding the tab name as "Add Department". Pass it to head in app.blade.php--}}
@section('content') {{--To fill in @yield content in layouts/app.blade.php--}}
<h1>Edit Department</h1> {{--Page Title--}}
<form method="POST" action="{{ route('departments.update', $department) }}"> {{--The action now points to departments.update and passes $department so Laravel knows which record to update (builds a URL like /departments/5). --}}
@csrf
@method('PUT') {{--@method('PUT') is added because HTML forms can only send GET or POST.--}}
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" name="name" id="name"
class="form-control @error('name') is-invalid @enderror"
value="{{ old('name', $department->name) }}"> {{--"old('name', $department->name)" is used here compared to "old('name')" in create, is because for this one we want to extract the old data to be in the field, while the other one is for when validation fail so that user would not need to reenter the datas to the field--}}
@error('name')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3">
<label for="code" class="form-label">Code</label>
<input type="text" name="code" id="code"
class="form-control @error('code') is-invalid @enderror"
value="{{ old('code', $department->code) }}">
@error('code')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3">
<label for="description" class="form-label">Description</label>
<textarea name="description" id="description" rows="3"
class="form-control @error('description') is-invalid @enderror">{{ old('description', $department->description) }}</textarea>
@error('description')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3 form-check">
<input type="checkbox" name="is_active" id="is_active"
class="form-check-input" value="1"
{{ old('is_active', $department->is_active) ? 'checked' : '' }}> {{--The fallback is the department's current value from the database. So if the department is active, the checkbox is checked. If it's inactive, the checkbox is unchecked. It matches what's actually saved rather than assuming.--}}
<label for="is_active" class="form-check-label">Active</label>
</div>
<a href="{{ route('departments.index') }}" class="btn btn-secondary">Cancel</a> {{--This button is to direct it to department page--}}
<button type="submit" class="btn btn-primary">Update</button> {{--Says "Update" instead of "Save" so the user knows they're changing an existing record, not creating a new one.--}}
</form>
@endsection
\ No newline at end of file
@extends('layouts.app') {{--To use the layout in layouts/app.blade.php--}}
@section('title', 'Departments') {{--To fill in the title in head in layouts/app.blade.php as the tab name--}}
@section('content') {{--To fill in @yield content in layouts/app.blade.php--}}
<div class="d-flex justify-content-between align-items-center mb-3">
<h1>Departments</h1> {{--Heading--}}
<a href="{{ route('departments.create') }}" class="btn btn-primary">+ Add Department</a> {{--Add department button--}}
</div>
<table class="table table-bordered table-hover"> {{--Creating the table--}}
<thead class="table-dark"> {{--Just the column headings with a dark background. Nothing dynamic here.--}}
<tr>
<th>Code</th> {{--Column Code--}}
<th>Name</th> {{--Column Name--}}
<th>Status</th> {{--Column Status--}}
<th>Actions</th> {{--Column Actions--}}
</tr>
</thead>
<tbody>
@forelse ($departments as $department) {{--This loops through the $departments collection that your controller in DepartmentController in index method passed to the view.--}}
<tr>
<td>{{ $department->code }}</td> {{--print the row's code column--}}
<td>{{ $department->name }}</td> {{--print the row's code column--}}
<td> {{--Is is_active true? If yes, use success. If no, use secondary. Inthis case secondary is "inactive"--}}
<span class="badge bg-{{ $department->is_active ? 'success' : 'secondary' }}"> {{--In Bootstrap 5, bg-success is green and bg-secondary is grey.--}}
{{ $department->is_active ? 'Active' : 'Inactive' }}
</span>
</td>
<td>
{{--View button--}}
<a href="{{ route('departments.show', $department) }}" class="btn btn-sm btn-info">View</a> {{--"route('departments.show', $department)" calls the row for that id when the button is clicked--}}
{{--Edit button--}}
<a href="{{ route('departments.edit', $department) }}" class="btn btn-sm btn-warning">Edit</a> {{--"route('departments.edit', $department)" ables to edit the row for that id when the button is clicked--}}
{{--Delete a row--}}
<form method="POST" action="{{ route('departments.destroy', $department) }}"
class="d-inline"
onsubmit="return confirm('Delete this department?')"> {{--shows a browser popup asking the user to confirm before the form submits. "d-inline" keeps the form on the same line as the View and Edit buttons.--}}
@csrf
@method('DELETE') {{--works the same way as @method('PUT') in the edit form. HTML forms can't send DELETE requests, so this hidden field tells Laravel to treat it as one.--}}
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="text-center">No departments found.</td> {{--This only runs if $departments has zero records.--}}
</tr>
@endforelse
</tbody>
</table>
{{ $departments->links() }} {{--This is for pagination (for page 1, 2, 3, 4, 5....). Providers/AppServiceprovide--}}
@endsection
\ No newline at end of file
@extends('layouts.app') {{--This extends the layout from layouts/app--}}
@section('title', $department->name) {{--Adding the tab name as "Add Department". Pass it to head in app.blade.php--}}
@section('content') {{--To fill in @yield content in layouts/app.blade.php--}}
<h1>{{ $department->name }}</h1> {{--The department chose--}}
<table class="table table-bordered w-50"> {{--A simple table with borders, taking up half the page width (w-50)--}}
<tr>
<th>Code</th>
<td>{{ $department->code }}</td>
</tr>
<tr>
<th>Name</th>
<td>{{ $department->name }}</td>
</tr>
<tr>
<th>Description</th> {{--"if description has a value, show it. If it's null, show N/A instead."--}}
<td>{{ $department->description ?? 'N/A' }}</td>
</tr>
<tr>
<th>Status</th>
<td>
<span class="badge bg-{{ $department->is_active ? 'success' : 'secondary' }}">
{{ $department->is_active ? 'Active' : 'Inactive' }}
</span> {{--Same ternary pattern you already used on the list page. Green badge for active, grey for inactive.--}}
</td>
</tr>
</table>
{{--Two navigation options. "Back to List" returns to /departments.
"Edit" takes the user straight to the edit form for this specific
department, building a URL like /departments/5/edit.--}}
<a href="{{ route('departments.index') }}" class="btn btn-secondary">Back to List</a>
<a href="{{ route('departments.edit', $department) }}" class="btn btn-warning">Edit</a> {{--"Edit" goes to departments.edit, which is /departments/{department}/edit. It needs to know which department to edit, so you pass $department and Laravel pulls the ID from it to build a URL like /departments/5/edit.--}}
@endsection
\ No newline at end of file
@extends('layouts.app')
@section('content')
<h1>Page not found</h1>
<a href="{{ route('home') }}">Back home</a>
@endsection
{{--
It only shows up when someone visits a URL that
doesn't exist, like mini-office.test/blahblah. Laravel
catches the "page not found" error and displays
this file instead of its default ugly error page. It
has nothing to do with success messages or alerts.
--}}
\ No newline at end of file
<!DOCTYPE html> {{--This tells the browser "this is a modern HTML5 document."--}}
<html lang="en">
<head>
<meta charset="UTF-8"> {{--universal standard that supports basically every language and symbol--}}
<meta name="viewport" content="width=device-width, initial-scale=1.0"> {{--This tells mobile browsers how to scale the page.--}}
<title>@yield('title', 'Mini Office')</title> {{-- If the page provides a title, use it. Otherwise, fall back to 'Mini Office' as the tab name--}}
@vite('resources/js/app.js') {{--It tells the browser to load the JavaScript and CSS bundle that Vite has prepared (which includes Bootstrap).--}}
</head>
<body>
@include('partials.header') {{--Goes to resources/views/partials/header.blade.php, grabs whatever HTML is inside--}}
<div class="container-fluid"> {{--Bootstrap class that creates a full-width container. It adds a small amount of padding on the left and right edges so content doesn't touch the browser walls.--}}
<div class="row"> {{--Activates Bootstrap's 12-column grid system--}}
<aside class="col-2 bg-light border-end min-vh-100"> {{--Takes up 2 out of 12 columns (about 16% of the width). The aside tag is semantic HTML meaning "this is secondary content," which is appropriate for a sidebar menu.--}}
@include('partials.sidebar')
</aside> {{--Basically this is for creating the sidebar--}}
<main class="col-10 py-4"> {{--Takes up the remaining 10 out of 12 columns--}}
@include('partials.flash') {{--Pulls in the flash message partial. This shows a green success box or error box when there's a message in the session.--}}
@yield('content') {{--This is the hole in the template. Whatever a page puts inside. @section('content') ... @endsection gets injected right here.--}}
</main>
</div>
</div>
@include('partials.footer') {{--Pulls in the footer partial. Like the header, it sits outside the grid so it stretches full width.--}}
</body>
</html>
{{--
STYLING in <aside>
col-2 — Takes up 2 out of Bootstrap's 12-column grid, so roughly 16% of the page width. This was already there.
bg-light — Fills the sidebar with a light grey background. This visually separates it from the white content area so the user can tell they're two different zones.
border-end — Adds a thin vertical line on the right edge of the sidebar. "End" means the right side in left-to-right languages. It acts like a wall between the sidebar and the main content.
min-vh-100 — Makes the sidebar at least 100% of the viewport height. "vh" stands for viewport height. Without it, if your page only has a few rows of content, the sidebar's grey background would stop halfway down the screen and look unfinished.
--}}
\ No newline at end of file
@extends('layouts.app')
@section('title', 'About') {{--"About" will be put inside "<title>@yield('title', 'Mini Office')</title>" in layouts/app.blade.php--}}
@section('content') {{--To put this content "@yield('content')" in layouts/app.blade.php--}}
<h1>About Us</h1>
<p>Mini Office helps manage departments, staff and assets in one place.</p>
@endsection
\ No newline at end of file
@extends('layouts.app')
@section('title', 'Contact') {{--"Services" will be put inside "<title>@yield('title', 'Mini Office')</title>" in layouts/app.blade.php--}}
@section('content') {{--To put this content "@yield('content')" in layouts/app.blade.php--}}
<h1>Contact Us</h1>
<p>Email us at <a href="mailto:admin@minioffice.test">admin@minioffice.test</a></p> {{--When someone clicks it, their default mail client (like Outlook or Gmail) opens with admin@minioffice.test already filled in as the recipient.--}}
@endsection
\ No newline at end of file
@extends('layouts.app')
@section('title', 'Home') {{--"Home" will be put inside "<title>@yield('title', 'Mini Office')</title>" in layouts/app.blade.php--}}
@section('content') {{--To put this content "@yield('content')" in layouts/app.blade.php--}}
<h1>Welcome to Mini Office</h1>
<p>This is the internal management system for our company.</p>
@endsection
\ No newline at end of file
@extends('layouts.app')
@section('title', 'Services') {{--"Services" will be put inside "<title>@yield('title', 'Mini Office')</title>" in layouts/app.blade.php--}}
@section('content') {{--To put this content "@yield('content')" in layouts/app.blade.php--}}
<h1>Our Services</h1>
<p>We provide department management, staff tracking and asset allocation.</p>
@endsection
\ No newline at end of file
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
{{--This file uses the structure in components/alert.blade.php--}}
{{--
@if (session('success'))
This is a Blade if statement. session('success') checks
whether there's a value stored in the session with the
key "success". The session is like a temporary sticky note
that Laravel holds onto for one page load and then throws
away. A controller puts a message there using ->with('success', 'Department created.'),
and on the very next page, session('success') reads it.
After that, it's gone.
If there's no message, this whole block is skipped and
nothing shows up on the page.
<div class="alert alert-success">{{ session('success') }}</div>
This only runs if the condition above is true. It creates
a green Bootstrap alert box. alert is the base class for
Bootstrap's alert component, and alert-success makes it
green (there's also alert-danger for red, alert-warning for
yellow, and alert-info for blue).
{{ session('success') }} prints whatever message the controller stored.
So if the controller sent "Department created.", you'd see a green box
with "Department created." inside it.
@endif
Closes the if block. Everything between @if and @endif
only runs when the condition is true.
--}}
{{--
<div class="alert alert-success">{{ session('success') }}</div>
What is this line for basically?
It creates a green box and puts the message inside it. That's it.
So if the session contains "Department created.", the browser ends up rendering:
<div class="alert alert-success">Department created.</div>
Which looks like a green banner at the top of the content area
with the text "Department created." inside it. The alert alert-success
classes are what make it green and styled like a notification box.
Without those classes, it would just be plain text with no background
colour or styling.
--}}
\ No newline at end of file
<footer class="text-center text-muted py-3 border-top mt-4 bg-light small">
&copy; {{ date('Y') }} Mini Office &middot; Laravel Training
</footer>
{{--
&copy;
This is an HTML entity that displays the © copyright symbol.
You can't easily type © on most keyboards, so HTML gives you
a shorthand.
{{ date('Y') }}
date('Y') is a PHP function that returns the current year as
a four-digit number (2026 right now). The {{ }} prints it onto
the page. So you never have to manually update the year every
January.
Mini Office
Just plain text, the name of the app.
--}}
{{--
STYLING
text-center — Centers the text horizontally within the footer.
text-muted — Makes the text a soft grey colour instead of black.
Footer content is secondary information, so it shouldn't compete
with the main content for attention.
py-3 — Adds padding on the top and bottom. "p" is padding, "y"
is the vertical axis, "3" is the size. Gives the footer breathing
room so the text isn't cramped against the edges.
border-top — Draws a thin horizontal line across the top of
the footer. It acts as a visual separator between the page
content and the footer.
mt-4 — Adds margin on top, pushing the footer away from whatever
content sits above it. Without it, the footer would stick right
against the last element on the page.
bg-light — Same light grey background as the sidebar. Using the
same colour on both makes the page feel consistent, like the
top (header) and bottom (footer) are framing the content.
small — Shrinks the text size. Footer text is supplementary,
so it should be smaller than the main body text.
&copy; — The HTML entity for the copyright symbol ©.
{{ date('Y') }} — PHP that outputs the current year (2026).
This way you never have to manually update it every January.
&middot; — The HTML entity for a middle dot (·). It's a
clean visual separator between "Mini Office" and "Laravel Training"
without using something heavy like a pipe or slash.
--}}
\ No newline at end of file
<nav class="navbar navbar-dark bg-dark px-3 shadow-sm">
<a class="navbar-brand fw-bold" href="{{ route('home') }}">
Mini Office
</a>
</nav>
{{--
This is a link styled as the brand or logo of the site.
navbar-brand is a Bootstrap class that makes the text
larger and bolder than regular nav links, so it stands
out as the site name. href="{{ route('home') }}" means
clicking it always takes you to the home page. Remember,
route('home') looks up the named route we defined in
web.php and outputs /.
If you had defined the route as Route::get('/dashboard', 'home')->name('home'),
then route('home') would output /dashboard instead. That's the whole benefit
of named routes: you refer to the name, and Laravel figures out the actual URL
for you.
--}}
{{--
STYLING
Added shadow-sm for a subtle drop shadow so the header
feels like it floats above the content.
--}}
\ No newline at end of file
<nav class="nav flex-column mt-3 px-2">
<p class="text-muted text-uppercase small fw-bold mb-1 px-3">Pages</p>
<a href="{{ route('home') }}" @class(['nav-link rounded', 'active fw-bold bg-primary text-white' => request()->routeIs('home')])>Home</a>
<a href="{{ route('about') }}" @class(['nav-link rounded', 'active fw-bold bg-primary text-white' => request()->routeIs('about')])>About</a>
<a href="{{ route('services') }}" @class(['nav-link rounded', 'active fw-bold bg-primary text-white' => request()->routeIs('services')])>Services</a>
<a href="{{ route('contact') }}" @class(['nav-link rounded', 'active fw-bold bg-primary text-white' => request()->routeIs('contact')])>Contact</a>
<hr class="my-2"> {{--A horizontal rule. my-2 — Controls the vertical spacing around the line.--}}
<p class="text-muted text-uppercase small fw-bold mb-1 px-3">Modules</p>
<a href="{{ route('departments.index') }}" @class(['nav-link rounded', 'active fw-bold bg-primary text-white' => request()->routeIs('departments.*')])>Departments</a>
<a href="{{ route('positions.index') }}" @class(['nav-link rounded', 'active fw-bold bg-primary text-white' => request()->routeIs('positions.*')])>Positions</a>
</nav>
{{--
- route('home') — outputs the URL for that named route,
same idea as the header link
- class([...]) — this is the clever bit. It always adds
nav-link. Then the part after => is a condition: request()->routeIs('home')
asks "is the user currently on the home route?" If yes, it also adds active
fw-bold. If no, it skips those classes. So the current page's link always
looks different from the others
--}}
{{--
What is named route?
Think of it like saving a contact in your phone.
You could memorise your friend's number (012-345-6789) and type it out every
time you call them. But if your friend changes their number, you'd have to
remember the new one and update it everywhere you wrote it down.
Or you could save the contact as "Ali" and just tap "Ali" whenever you want
to call. If Ali changes his number, you update it once in your contacts, and
every call to "Ali" still works.
Named routes are the same idea. Instead of writing the URL /about in 10 different
Blade files, you give the route a name:
Route::get('/about', 'about')->name('about');
Now everywhere in your app, you write route('about') instead of /about.
If you later decide to change the URL to /about-us, you change it in one
place (the route file), and every route('about') across your entire app
automatically outputs /about-us. Nothing breaks.
--}}
{{--
STYLING:
- nav-link — Bootstrap's default styling for navigation links. It adds padding, removes the underline, and makes the text a muted colour that darkens on hover.
- rounded — Adds slightly curved corners to the link. Without it, when the active link gets the blue background, it would have sharp square edges which looks harsh.
- active — A Bootstrap class that tells the browser "this is the current page." On its own it just slightly changes the text colour, which is why we add more classes alongside it.
- fw-bold — Makes the text bold. "fw" stands for font-weight. So the current page link is visually heavier than the others.
- bg-primary — Fills the background with Bootstrap's primary colour, which is blue by default. This creates a solid coloured block behind the active link so it really stands out from the rest.
- text-white — Changes the text to white. Without this, the text would stay dark and be hard to read against the blue background.
--}}
\ No newline at end of file
@extends('layouts.app')
@section('title', 'Add Position')
@section('content')
<h1>Add Position</h1>
<form method="POST" action="{{ route('positions.store') }}">
@csrf
<div class="mb-3">
<label class="form-label">Name</label>
<input name="name" value="{{ old('name') }}" class="form-control @error('name') is-invalid @enderror">
@error('name')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3">
<label class="form-label">Code</label>
<input name="code" value="{{ old('code') }}" class="form-control @error('code') is-invalid @enderror">
@error('code')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3">
<label class="form-label">Description</label>
<textarea name="description" class="form-control @error('description') is-invalid @enderror">{{ old('description') }}</textarea>
@error('description')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3 form-check">
<input type="checkbox" name="is_active" value="1" class="form-check-input" {{ old('is_active', true) ? 'checked' : '' }}>
<label class="form-check-label">Active</label>
</div>
<a href="{{ route('positions.index') }}" class="btn btn-secondary">Cancel</a>
<button class="btn btn-primary">Save</button>
</form>
@endsection
\ No newline at end of file
@extends('layouts.app')
@section('title', 'Edit Position')
@section('content')
<h1>Edit Position</h1>
<form method="POST" action="{{ route('positions.update', $position) }}">
@csrf
@method('PUT')
<div class="mb-3">
<label class="form-label">Name</label>
<input name="name" value="{{ old('name', $position->name) }}" class="form-control @error('name') is-invalid @enderror">
@error('name')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3">
<label class="form-label">Code</label>
<input name="code" value="{{ old('code', $position->code) }}" class="form-control @error('code') is-invalid @enderror">
@error('code')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3">
<label class="form-label">Description</label>
<textarea name="description" class="form-control @error('description') is-invalid @enderror">{{ old('description', $position->description) }}</textarea>
@error('description')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="mb-3 form-check">
<input type="checkbox" name="is_active" value="1" class="form-check-input" {{ old('is_active', $position->is_active) ? 'checked' : '' }}>
<label class="form-check-label">Active</label>
</div>
<a href="{{ route('positions.index') }}" class="btn btn-secondary">Cancel</a>
<button class="btn btn-primary">Update</button>
</form>
@endsection
\ No newline at end of file
@extends('layouts.app')
@section('title', 'Positions')
@section('content')
<div class="d-flex justify-content-between align-items-center mb-3">
<h1>Positions</h1>
<a href="{{ route('positions.create') }}" class="btn btn-primary">+ Add</a>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@forelse ($positions as $position)
<tr>
<td>{{ $position->code }}</td>
<td>{{ $position->name }}</td>
<td>{{ $position->is_active ? 'Active' : 'Inactive' }}</td>
<td>
<a href="{{ route('positions.show', $position) }}" class="btn btn-sm btn-info">View</a>
<a href="{{ route('positions.edit', $position) }}" class="btn btn-sm btn-warning">Edit</a>
<form method="POST" action="{{ route('positions.destroy', $position) }}" class="d-inline" onsubmit="return confirm('Delete this position?')">
@csrf
@method('DELETE')
<button class="btn btn-sm btn-danger">Delete</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="4">No positions found.</td>
</tr>
@endforelse
</tbody>
</table>
{{ $positions->links() }}
@endsection
\ No newline at end of file
@extends('layouts.app')
@section('title', 'View Position')
@section('content')
<h1>{{ $position->name }}</h1>
<table class="table table-bordered" style="max-width: 500px;">
<tr>
<th>Code</th>
<td>{{ $position->code }}</td>
</tr>
<tr>
<th>Name</th>
<td>{{ $position->name }}</td>
</tr>
<tr>
<th>Description</th>
<td>{{ $position->description ?? 'N/A' }}</td>
</tr>
<tr>
<th>Status</th>
<td>{{ $position->is_active ? 'Active' : 'Inactive' }}</td>
</tr>
<tr>
<th>Created</th>
<td>{{ $position->created_at->format('d M Y') }}</td>
</tr>
</table>
<a href="{{ route('positions.index') }}" class="btn btn-secondary">Back</a>
<a href="{{ route('positions.edit', $position) }}" class="btn btn-warning">Edit</a>
@endsection
\ No newline at end of file
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
<?php
use App\Http\Controllers\PositionController;
use App\Http\Controllers\DepartmentController;
use App\Http\Controllers\PageController;
use Illuminate\Support\Facades\Route;
Route::controller(PageController::class)->group(function () { //This tells Laravel "every route inside this group uses PageController and not DepartmentController
Route::get('/', 'home')->name('home'); // This is to route to home page
Route::get('/about', 'about')->name('about'); // This is to route to about page
Route::get('/services', 'services')->name('services'); // This is to route to services page
Route::get('/contact', 'contact')->name('contact'); // This is to route to contact page
});
Route::resource('departments', DepartmentController::class); // registers seven routes that all point to your DepartmentController. Put this outside PageController
Route::resource('positions', PositionController::class); // registers seven routes that all point to your PositionController.php. Put this outside PageController
/*
Route::get creates one single route. Your About page
only needs one route: when someone visits /about, show
the about page. That's it. No forms, no saving, no
deleting. One URL, one method, done.
Route::resource creates seven routes at once. Your
Departments module needs all seven because it has a
list page, a create form, saving, viewing, editing,
updating, and deleting. You could write them all individually
with Route::get, Route::post, Route::put, and Route::delete,
*/
\ No newline at end of file
*
!private/
!public/
!.gitignore
compiled.php
config.php
down
events.scanned.php
lsp-*.php
maintenance.php
routes.php
routes.scanned.php
schedule-*
services.json
*
!data/
!locks/
!.gitignore
<?php
namespace Tests\Feature;
// use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*/
public function test_the_application_returns_a_successful_response(): void
{
$response = $this->get('/');
$response->assertStatus(200);
}
}
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
//
}
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*/
public function test_that_true_is_true(): void
{
$this->assertTrue(true);
}
}
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import { bunny } from 'laravel-vite-plugin/fonts';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
fonts: [
bunny('Instrument Sans', {
weights: [400, 500, 600],
}),
],
}),
tailwindcss(),
],
server: {
watch: {
ignored: ['**/storage/framework/views/**'],
},
},
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment