Skip to content

Commit 8747ff3

Browse files
committed
Merge branch 'develop' into update-print-invtentory-view-with-assigned2assets
# Conflicts: # app/Http/Controllers/ProfileController.php # app/Http/Controllers/Users/UsersController.php
2 parents 4ddd2f1 + 0a4ec84 commit 8747ff3

7,003 files changed

Lines changed: 249667 additions & 208896 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.

.git-blame-ignore-revs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Pint: Models
2+
9623fa4d87e7fb38307028338c6991afb7d4e099
3+
4+
# Pint: Actions
5+
a3c7410c35388af08997b1c52adebda1056488a6
6+
7+
# Pint: Console
8+
8bce38b9187d23089a28a4f3a4ab960ac7471e90
9+
10+
# Pint: Enums and Events
11+
f7b82ad1ff513a25d775c20b58e9a8ce23461ec2
12+
13+
# Pint: Exceptions
14+
2e7046a810ce1f7562dec9d3ee4fee0cbc7262db
15+
16+
# Pint: Non-api controllers
17+
9bc92f57c8a29ac0e89c2d3f72f23c6c64567dd8
18+
19+
# Pint: Api controllers
20+
1e5d426e70dcd72fd7e87c2b11ff42fe3cc7a1a4
21+
22+
# Pint: Middleware
23+
ec6caf9b5959c6c57bd7be047e91bbb70fc303a7
24+
25+
# Pint: Requests
26+
93168326da54fa87880570c82df3ccbf3ff152e1
27+
28+
# Pint: Traits and Transformers
29+
a613380811f63f51e2951d2f4b8454d5274d5cdf
30+
31+
# Pint: Importer
32+
3e831bf9b3cc060f11c88ec69a9313131de8ee1f
33+
34+
# Pint: Jobs and Listeners
35+
317b1a462e079bf96d492dd3782de38b7144be9f
36+
37+
# Pint: Livewire
38+
53f2ef2ca11b0571de758b101f08f259de7830cf
39+
40+
# Pint: Mail
41+
de607e7d83704b30f809238c44d3d759196a77db
42+
43+
# Pint: Notifications
44+
31043d1f5cb5d287c0ab2ca2ba1ae08665bc6ad5
45+
46+
# Pint: Observers and policies
47+
b2c0a21230977443536655e43e524773e2ad9e27
48+
49+
# Pint: Presenters
50+
55d46cbefec5fe0bb7e28b859d540977d2cfee46
51+
52+
# Pint: Providers
53+
8b658a19b9182bf9a19e34bc9101ee11a13ed85b
54+
55+
# Pint: Config
56+
c1a93e3ac890ed1fc1c27ba6c431f6b58ff661d6
57+
58+
# Pint: Lang and resources
59+
84fdb5d6c19bf7882cb91d42fe8768fc0db0ce67
60+
61+
# Pint: Database
62+
b5a46a370f85c6e87c8a9fa4a4593424bb027712
63+
64+
# Pint: Tests
65+
d84eb43278177a9bcdfffe04c94d933eb49f2c48
66+
446f5f3cefdc1837a65fd4bc983741b29f821a78

.github/copilot-instructions.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# GitHub Copilot Custom Instructions for Snipe-IT
2+
3+
These instructions guide Copilot to generate code that aligns with modern Laravel 11 standards, PHP 8.2/8.4 features, software engineering principles, and industry best practices to improve software quality, maintainability, and security.
4+
5+
## ✅ General Coding Standards
6+
7+
- Prefer short, expressive, and readable code.
8+
- Use **meaningful, descriptive variable, function, class, and file names**.
9+
- Apply proper PHPDoc blocks for classes, methods, and complex logic.
10+
- Organize code into small, reusable functions or classes with single responsibility.
11+
- Avoid magic numbers or hard-coded strings; use constants or config files.
12+
13+
## ✅ PHP 8.2/8.4 Best Practices
14+
15+
- Use **readonly properties** to enforce immutability where applicable.
16+
- Use **Enums** instead of string or integer constants.
17+
- Utilize **First-class callable syntax** for callbacks.
18+
- Leverage **Constructor Property Promotion**.
19+
- Use **Union Types**, **Intersection Types**, and **true/false return types** for strict typing.
20+
- Apply **Static Return Type** where needed.
21+
- Use the **Nullsafe Operator (?->)** for optional chaining.
22+
- Adopt **final classes** where extension is not intended.
23+
- Use **Named Arguments** for improved clarity when calling functions with multiple parameters.
24+
25+
## ✅ Laravel 11 Project Structure & Conventions
26+
27+
- Follow the official Laravel project structure:
28+
- `app/Http/Controllers` - Controllers
29+
- `app/Models` - Eloquent models
30+
- `app/Http/Requests` - Form request validation
31+
- `app/Http/Resources` - API resource responses
32+
- `app/Enums` - Enums
33+
- `app/Actions` - Single-responsibility action classes
34+
- `app/Policies` - Authorization logic
35+
36+
- Controllers must:
37+
- Use dependency injection.
38+
- Use Form Requests for validation. The request class should utilize the rules set on the model.
39+
- Return typed responses (e.g., `JsonResponse`).
40+
- Use Transformers for API responses.
41+
42+
## ✅ Eloquent ORM & Database
43+
44+
- Use **Eloquent Models** with proper `$fillable` or `$guarded` attributes for mass assignment protection.
45+
- Utilize **casts** for date, boolean, JSON, and custom data types.
46+
- Apply **accessors & mutators** for attribute transformation.
47+
- Avoid direct raw SQL unless absolutely necessary; prefer Eloquent or Query Builder.
48+
- Migrations:
49+
- Always use migrations for schema changes.
50+
- Include proper constraints (foreign keys, unique indexes, etc.).
51+
- Prefer UUIDs or ULIDs as primary keys where applicable.
52+
53+
## ✅ API Development
54+
55+
- Use **Transformer classes** for consistent and structured JSON responses.
56+
- Apply **route model binding** where possible.
57+
- Use Form Requests for input validation.
58+
59+
## ✅ Blade & Frontend (if applicable)
60+
61+
- Keep Blade templates clean and logic-free; use View Composers or dedicated View Models for complex data.
62+
- Use `@props`, `@aware`, `@once` Blade features appropriately.
63+
- Utilize Alpine.js or Livewire for interactive frontend logic (optional).
64+
65+
## ✅ Security Best Practices
66+
67+
- Never trust user input; always validate and sanitize inputs.
68+
- Use prepared statements via Eloquent or Query Builder to prevent SQL injection.
69+
- Use Laravel's built-in CSRF, XSS, and validation mechanisms.
70+
- Store sensitive information in `.env`, never hard-code secrets.
71+
- Apply proper authorization checks using Policies or Gates.
72+
- Follow principle of least privilege for users, roles, and permissions.
73+
74+
## ✅ Testing Standards
75+
76+
- Use **factories** for test data setup.
77+
- Include feature tests for user-facing functionality.
78+
- Include unit tests for business logic, services, and helper classes.
79+
- Mock external services using Laravel's `Http::fake()` or equivalent.
80+
- Maintain high code coverage but focus on meaningful tests over 100% coverage obsession.
81+
82+
## ✅ Software Quality & Maintainability
83+
84+
- Follow **SOLID Principles**:
85+
- Single Responsibility Principle (SRP)
86+
- Open/Closed Principle (OCP)
87+
- Liskov Substitution Principle (LSP)
88+
- Interface Segregation Principle (ISP)
89+
- Dependency Inversion Principle (DIP)
90+
91+
- Follow **DRY** (Don't Repeat Yourself) and **KISS** (Keep It Simple, Stupid) principles.
92+
- Apply **YAGNI** (You Aren't Gonna Need It) to avoid overengineering.
93+
- Document complex logic with PHPDoc and inline comments.
94+
95+
## ✅ Performance & Optimization
96+
97+
- Eager load relationships to avoid N+1 queries.
98+
- Use caching with Laravel's Cache system for frequently accessed data.
99+
- Paginate large datasets using `paginate()` instead of `get()`.
100+
- Queue long-running tasks using Laravel Queues.
101+
- Optimize database indexes for common queries.
102+
103+
## ✅ Modern Laravel Features to Use
104+
105+
- Use **Event Broadcasting** if real-time updates are needed.
106+
- Use **Full-text search** if search functionality is required.
107+
- Use **Rate Limiting** for API routes.
108+
109+
## ✅ Additional Copilot Behavior Preferences
110+
111+
- Generate **strictly typed**, modern PHP code using latest language features.
112+
- Prioritize **readable, clean, maintainable** code over cleverness.
113+
- Avoid legacy or deprecated Laravel patterns (facade overuse, logic-heavy views, etc.).
114+
- Suggest proper class placement based on Laravel directory structure.
115+
- Suggest tests alongside new features where applicable.
116+
- Default to **immutability**, **dependency injection**, and **encapsulation** best practices.
117+
No newline at end of file

.github/workflows/codacy-analysis.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/docker-alpine.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ jobs:
4646

4747
# https://github.com/docker/setup-buildx-action
4848
- name: Setup Docker Buildx
49-
uses: docker/setup-buildx-action@v3
49+
uses: docker/setup-buildx-action@v4
5050

5151
# https://github.com/docker/login-action
5252
- name: Login to DockerHub
5353
# Only login if not a PR, as PRs only trigger a Docker build and not a push
5454
if: github.event_name != 'pull_request'
55-
uses: docker/login-action@v3
55+
uses: docker/login-action@v4
5656
with:
5757
username: ${{ secrets.DOCKER_USERNAME }}
5858
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
@@ -64,7 +64,7 @@ jobs:
6464
# Get Metadata for docker_build step below
6565
- name: Sync metadata (tags, labels) from GitHub to Docker for 'snipe-it' image
6666
id: meta_build
67-
uses: docker/metadata-action@v5
67+
uses: docker/metadata-action@v6
6868
with:
6969
images: snipe/snipe-it
7070
tags: ${{ env.IMAGE_TAGS }}
@@ -73,7 +73,7 @@ jobs:
7373
# https://github.com/docker/build-push-action
7474
- name: Build and push 'snipe-it' image
7575
id: docker_build
76-
uses: docker/build-push-action@v6
76+
uses: docker/build-push-action@v7
7777
with:
7878
context: .
7979
file: ./Dockerfile.alpine

.github/workflows/docker-ubuntu.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ jobs:
4646

4747
# https://github.com/docker/setup-buildx-action
4848
- name: Setup Docker Buildx
49-
uses: docker/setup-buildx-action@v3
49+
uses: docker/setup-buildx-action@v4
5050

5151
# https://github.com/docker/login-action
5252
- name: Login to DockerHub
5353
# Only login if not a PR, as PRs only trigger a Docker build and not a push
5454
if: github.event_name != 'pull_request'
55-
uses: docker/login-action@v3
55+
uses: docker/login-action@v4
5656
with:
5757
username: ${{ secrets.DOCKER_USERNAME }}
5858
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
@@ -64,7 +64,7 @@ jobs:
6464
# Get Metadata for docker_build step below
6565
- name: Sync metadata (tags, labels) from GitHub to Docker for 'snipe-it' image
6666
id: meta_build
67-
uses: docker/metadata-action@v5
67+
uses: docker/metadata-action@v6
6868
with:
6969
images: snipe/snipe-it
7070
tags: ${{ env.IMAGE_TAGS }}
@@ -73,7 +73,7 @@ jobs:
7373
# https://github.com/docker/build-push-action
7474
- name: Build and push 'snipe-it' image
7575
id: docker_build
76-
uses: docker/build-push-action@v6
76+
uses: docker/build-push-action@v7
7777
with:
7878
context: .
7979
file: ./Dockerfile

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![snipe-it-by-grok](https://github.com/grokability/snipe-it/assets/197404/b515673b-c7c8-4d9a-80f5-9fa58829a602)
22

3-
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/804dd1beb14a41f38810ab77d64fc4fc)](https://app.codacy.com/gh/grokability/snipe-it/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Tests](https://github.com/grokability/snipe-it/actions/workflows/tests.yml/badge.svg)](https://github.com/grokability/snipe-it/actions/workflows/tests.yml)
3+
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/804dd1beb14a41f38810ab77d64fc4fc)](https://app.codacy.com/gh/grokability/snipe-it/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Tests in MySQL](https://github.com/grokability/snipe-it/actions/workflows/tests-mysql.yml/badge.svg)](https://github.com/grokability/snipe-it/actions/workflows/tests-mysql.yml)
44
[![All Contributors](https://img.shields.io/badge/all_contributors-331-orange.svg?style=flat-square)](#contributing) [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/yZFtShAcKk)
55

66
## Snipe-IT - Open Source Asset Management System
@@ -124,7 +124,7 @@ We're currently working on our own mobile app, but in the meantime, check out th
124124

125125
### Contributing
126126

127-
**Please refrain from submitting issues or pull requests generated by fully-automated tools. Maintainers reserve the right, at their sole discretion, to close such submissions and to block any account responsible for them.**
127+
**Please refrain from submitting issues or pull requests generated by fully-automated tools. Maintainers reserve the right, at their sole discretion, to close such submissions and to block any account responsible for them.** Please see our [AI Contribution Policy](https://snipe-it.readme.io/docs/contributing-overview#ai-usage-policy) for more information.
128128

129129
Contributions should follow from a human-to-human discussion in the form of an issue for the best chances of being merged into the core project. (Sometimes we might already be working on that feature, sometimes we've decided against )
130130

app/Actions/Categories/DestroyCategoryAction.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class DestroyCategoryAction
2121
* @throws ItemStillHasLicenses
2222
* @throws ItemStillHasConsumables
2323
*/
24-
static function run(Category $category): bool
24+
public static function run(Category $category): bool
2525
{
2626
$category->loadCount([
2727
'assets as assets_count',
2828
'accessories as accessories_count',
2929
'consumables as consumables_count',
3030
'components as components_count',
3131
'licenses as licenses_count',
32-
'models as models_count'
32+
'models as models_count',
3333
]);
3434

3535
if ($category->assets_count > 0) {
@@ -56,4 +56,4 @@ static function run(Category $category): bool
5656

5757
return true;
5858
}
59-
}
59+
}

app/Actions/CheckoutRequests/CancelCheckoutRequestAction.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class CancelCheckoutRequestAction
1414
{
1515
public static function run(Asset $asset, User $user)
1616
{
17-
if (!Company::isCurrentUserHasAccess($asset)) {
18-
throw new AuthorizationException();
17+
if (! Company::isCurrentUserHasAccess($asset)) {
18+
throw new AuthorizationException;
1919
}
2020

2121
$asset->cancelRequest();
@@ -27,7 +27,7 @@ public static function run(Asset $asset, User $user)
2727
$data['item_quantity'] = 1;
2828
$settings = Setting::getSettings();
2929

30-
$logaction = new Actionlog();
30+
$logaction = new Actionlog;
3131
$logaction->item_id = $data['asset_id'] = $asset->id;
3232
$logaction->item_type = $data['item_type'] = Asset::class;
3333
$logaction->created_at = $data['requested_date'] = date('Y-m-d H:i:s');
@@ -44,5 +44,4 @@ public static function run(Asset $asset, User $user)
4444

4545
return true;
4646
}
47-
48-
}
47+
}

0 commit comments

Comments
 (0)