Skip to content

Commit 1e6d2ea

Browse files
committed
feat(finance): Phase 131 — Finance Cash Flow Forecasting
Add CashFlowForecast model, policy, controller, routes, React stubs, and full Pest test suite (9 tests) for CRUD + publish/archive lifecycle. https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
1 parent f85b064 commit 1e6d2ea

1,391 files changed

Lines changed: 132521 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

erp/.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[{compose,docker-compose}.{yml,yaml}]
18+
indent_size = 4

erp/.env.example

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
APP_LOCALE=en
8+
APP_FALLBACK_LOCALE=en
9+
APP_FAKER_LOCALE=en_US
10+
11+
APP_MAINTENANCE_DRIVER=file
12+
# APP_MAINTENANCE_STORE=database
13+
14+
# PHP_CLI_SERVER_WORKERS=4
15+
16+
BCRYPT_ROUNDS=12
17+
18+
LOG_CHANNEL=stack
19+
LOG_STACK=single
20+
LOG_DEPRECATIONS_CHANNEL=null
21+
LOG_LEVEL=debug
22+
23+
DB_CONNECTION=sqlite
24+
# DB_HOST=127.0.0.1
25+
# DB_PORT=3306
26+
# DB_DATABASE=laravel
27+
# DB_USERNAME=root
28+
# DB_PASSWORD=
29+
30+
SESSION_DRIVER=database
31+
SESSION_LIFETIME=120
32+
SESSION_ENCRYPT=false
33+
SESSION_PATH=/
34+
SESSION_DOMAIN=null
35+
36+
BROADCAST_CONNECTION=log
37+
FILESYSTEM_DISK=local
38+
QUEUE_CONNECTION=database
39+
40+
CACHE_STORE=database
41+
# CACHE_PREFIX=
42+
43+
MEMCACHED_HOST=127.0.0.1
44+
45+
REDIS_CLIENT=phpredis
46+
REDIS_HOST=127.0.0.1
47+
REDIS_PASSWORD=null
48+
REDIS_PORT=6379
49+
50+
MAIL_MAILER=log
51+
MAIL_SCHEME=null
52+
MAIL_HOST=127.0.0.1
53+
MAIL_PORT=2525
54+
MAIL_USERNAME=null
55+
MAIL_PASSWORD=null
56+
MAIL_FROM_ADDRESS="hello@example.com"
57+
MAIL_FROM_NAME="${APP_NAME}"
58+
59+
AWS_ACCESS_KEY_ID=
60+
AWS_SECRET_ACCESS_KEY=
61+
AWS_DEFAULT_REGION=us-east-1
62+
AWS_BUCKET=
63+
AWS_USE_PATH_STYLE_ENDPOINT=false
64+
65+
VITE_APP_NAME="${APP_NAME}"

erp/.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* text=auto eol=lf
2+
3+
*.blade.php diff=html
4+
*.css diff=css
5+
*.html diff=html
6+
*.md diff=markdown
7+
*.php diff=php
8+
9+
/.github export-ignore
10+
CHANGELOG.md export-ignore
11+
.styleci.yml export-ignore

erp/.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
*.log
2+
.DS_Store
3+
.env
4+
.env.backup
5+
.env.production
6+
.phpactor.json
7+
.phpunit.result.cache
8+
/.codex
9+
/.cursor/
10+
/.idea
11+
/.nova
12+
/.phpunit.cache
13+
/.vscode
14+
/.zed
15+
/auth.json
16+
/node_modules
17+
/public/build
18+
/public/fonts-manifest.dev.json
19+
/public/hot
20+
/public/storage
21+
/storage/*.key
22+
/storage/pail
23+
/vendor
24+
_ide_helper.php
25+
Homestead.json
26+
Homestead.yaml
27+
Thumbs.db
28+
erp/.env.bak

erp/.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignore-scripts=true
2+
audit=true

erp/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<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>
2+
3+
<p align="center">
4+
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
5+
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
6+
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
7+
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
8+
</p>
9+
10+
## About Laravel
11+
12+
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:
13+
14+
- [Simple, fast routing engine](https://laravel.com/docs/routing).
15+
- [Powerful dependency injection container](https://laravel.com/docs/container).
16+
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
17+
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
18+
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
19+
- [Robust background job processing](https://laravel.com/docs/queues).
20+
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
21+
22+
Laravel is accessible, powerful, and provides tools required for large, robust applications.
23+
24+
## Learning Laravel
25+
26+
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.
27+
28+
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.
29+
30+
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.
31+
32+
## Agentic Development
33+
34+
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:
35+
36+
```bash
37+
composer require laravel/boost --dev
38+
39+
php artisan boost:install
40+
```
41+
42+
Boost provides your agent 15+ tools and skills that help agents build Laravel applications while following best practices.
43+
44+
## Contributing
45+
46+
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
47+
48+
## Code of Conduct
49+
50+
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).
51+
52+
## Security Vulnerabilities
53+
54+
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.
55+
56+
## License
57+
58+
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Admin;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Models\User;
7+
use App\Modules\Core\Models\AuditLog;
8+
use Illuminate\Http\Request;
9+
use Inertia\Inertia;
10+
use Inertia\Response;
11+
12+
class AuditLogController extends Controller
13+
{
14+
public function index(Request $request): Response
15+
{
16+
$this->authorize('viewAny', User::class);
17+
18+
$logs = AuditLog::with('user')
19+
->where('tenant_id', auth()->user()->tenant_id)
20+
->when($request->event, fn ($q) => $q->where('event', $request->event))
21+
->when($request->model, fn ($q) => $q->where('auditable_type', 'like', "%{$request->model}%"))
22+
->latest()
23+
->paginate(50)
24+
->withQueryString()
25+
->through(fn ($log) => [
26+
'id' => $log->id,
27+
'event' => $log->event,
28+
'model' => class_basename($log->auditable_type),
29+
'model_id' => $log->auditable_id,
30+
'user' => $log->user?->name ?? 'System',
31+
'old_values' => $log->old_values,
32+
'new_values' => $log->new_values,
33+
'ip_address' => $log->ip_address,
34+
'created_at' => $log->created_at->diffForHumans(),
35+
'created_at_raw' => $log->created_at->toDateTimeString(),
36+
]);
37+
38+
return Inertia::render('Admin/AuditLog/Index', [
39+
'logs' => $logs,
40+
'filters' => $request->only(['event', 'model']),
41+
'breadcrumbs' => [
42+
['label' => 'Administration'],
43+
['label' => 'Audit Log', 'href' => route('admin.audit-log.index')],
44+
],
45+
]);
46+
}
47+
}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Admin;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Models\User;
7+
use Illuminate\Http\RedirectResponse;
8+
use Illuminate\Http\Request;
9+
use Illuminate\Support\Facades\Hash;
10+
use Illuminate\Validation\Rules\Password;
11+
use Inertia\Inertia;
12+
use Inertia\Response;
13+
use Spatie\Permission\Models\Role;
14+
15+
class UserController extends Controller
16+
{
17+
public function index(Request $request): Response
18+
{
19+
$this->authorize('viewAny', User::class);
20+
21+
$users = User::with('roles')
22+
->when($request->search, fn ($q) => $q->where('name', 'like', "%{$request->search}%")
23+
->orWhere('email', 'like', "%{$request->search}%"))
24+
->where('tenant_id', auth()->user()->tenant_id)
25+
->orderBy('name')
26+
->paginate(25)
27+
->withQueryString();
28+
29+
return Inertia::render('Admin/Users/Index', [
30+
'users' => $users->through(fn ($u) => [
31+
'id' => $u->id,
32+
'name' => $u->name,
33+
'email' => $u->email,
34+
'roles' => $u->roles->pluck('name'),
35+
'created_at' => $u->created_at?->toDateString(),
36+
]),
37+
'filters' => $request->only(['search']),
38+
'breadcrumbs' => [
39+
['label' => 'Administration'],
40+
['label' => 'Users', 'href' => route('admin.users.index')],
41+
],
42+
]);
43+
}
44+
45+
public function create(): Response
46+
{
47+
$this->authorize('create', User::class);
48+
49+
return Inertia::render('Admin/Users/Create', [
50+
'roles' => Role::orderBy('name')->pluck('name'),
51+
'breadcrumbs' => [
52+
['label' => 'Administration'],
53+
['label' => 'Users', 'href' => route('admin.users.index')],
54+
['label' => 'New User'],
55+
],
56+
]);
57+
}
58+
59+
public function store(Request $request): RedirectResponse
60+
{
61+
$this->authorize('create', User::class);
62+
63+
$data = $request->validate([
64+
'name' => ['required', 'string', 'max:255'],
65+
'email' => ['required', 'email', 'max:255', 'unique:users,email'],
66+
'password' => ['required', Password::defaults()],
67+
'role' => ['required', 'string', 'exists:roles,name'],
68+
]);
69+
70+
$user = User::create([
71+
'name' => $data['name'],
72+
'email' => $data['email'],
73+
'password' => Hash::make($data['password']),
74+
'tenant_id' => auth()->user()->tenant_id,
75+
]);
76+
77+
$user->assignRole($data['role']);
78+
79+
return redirect()->route('admin.users.index')
80+
->with('success', 'User created.');
81+
}
82+
83+
public function edit(User $user): Response
84+
{
85+
$this->authorize('update', $user);
86+
87+
return Inertia::render('Admin/Users/Edit', [
88+
'user' => [
89+
'id' => $user->id,
90+
'name' => $user->name,
91+
'email' => $user->email,
92+
'role' => $user->roles->first()?->name,
93+
],
94+
'roles' => Role::orderBy('name')->pluck('name'),
95+
'breadcrumbs' => [
96+
['label' => 'Administration'],
97+
['label' => 'Users', 'href' => route('admin.users.index')],
98+
['label' => $user->name . ' — Edit'],
99+
],
100+
]);
101+
}
102+
103+
public function update(Request $request, User $user): RedirectResponse
104+
{
105+
$this->authorize('update', $user);
106+
107+
$data = $request->validate([
108+
'name' => ['required', 'string', 'max:255'],
109+
'email' => ['required', 'email', 'max:255', "unique:users,email,{$user->id}"],
110+
'password' => ['nullable', Password::defaults()],
111+
'role' => ['required', 'string', 'exists:roles,name'],
112+
]);
113+
114+
$user->update([
115+
'name' => $data['name'],
116+
'email' => $data['email'],
117+
...(($data['password'] ?? null) ? ['password' => Hash::make($data['password'])] : []),
118+
]);
119+
120+
$user->syncRoles([$data['role']]);
121+
122+
return redirect()->route('admin.users.index')
123+
->with('success', 'User updated.');
124+
}
125+
126+
public function destroy(User $user): RedirectResponse
127+
{
128+
$this->authorize('delete', $user);
129+
130+
if ($user->id === auth()->id()) {
131+
return back()->withErrors(['user' => 'You cannot delete your own account.']);
132+
}
133+
134+
$user->delete();
135+
136+
return redirect()->route('admin.users.index')
137+
->with('success', 'User deleted.');
138+
}
139+
}

0 commit comments

Comments
 (0)