Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Fix Code Style

on: [push]

jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.4]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, dom, curl, libxml, mbstring
coverage: none

- name: Install Pint
run: composer global require laravel/pint

- name: Run Pint
run: pint

- name: Commit linted files
uses: stefanzweifel/git-auto-commit-action@v5
211 changes: 166 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,189 @@
<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>
# ComputerScienceResources.com

## About Laravel
[![Feature Tests](https://github.com/AllanKoder/ComputerScienceResources.com/actions/workflows/feature-tests.yml/badge.svg?branch=master)](https://github.com/AllanKoder/ComputerScienceResources.com/actions/workflows/feature-tests.yml)
[![Fix Code Style](https://github.com/AllanKoder/ComputerScienceResources.com/actions/workflows/lint.yml/badge.svg)](https://github.com/AllanKoder/ComputerScienceResources.com/actions/workflows/lint.yml)

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:
Welcome to the codebase for [ComputerScienceResources.com](https://computerscienceresources.com) — a curated platform for discovering, reviewing, and sharing the best resources in computer science and software engineering.

https://webdevetc.com/blog/laravel-naming-conventions/
![Computer Science Logo](public/images/Logo.svg)
<p align="center"><em>This is our mascot, look how studious this little guy is!</em></p>

- [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).
This website helps developers and learners find high-quality, structured, and community-reviewed resources across all areas of computer science. Our mission is to make learning easier by organizing and highlighting the best content, and to empower the community to contribute, review, and improve resource listings.

Laravel is accessible, powerful, and provides tools required for large, robust applications.

## Learning Laravel
## App Features

Here's what you can do on ComputerScienceResources.com — all designed to make your learning journey easier, more fun, and community-driven:

- **Add New Resources:** Share your favorite computer science and software engineering resources with the world.
- **Upvote & Downvote:** Show your support (or not!) for resources, reviews, and comments. Change your mind? You can always update or remove your vote.
- **Write Reviews:** Leave thoughtful reviews for resources you’ve tried. Each user can post one review per resource, and reviews can be upvoted, commented on, and edited.
- **Comment Anywhere:** Start conversations on resources, reviews, or even other comments. Comments are nested, paginated, and easy to follow — just like your favorite forums.
- **Suggest Edits:** See something that could be improved? Propose edits to any resource. The community can discuss, vote, and help merge the best changes.
- **Resource Filtering:** Filter resources by name, description, platform, difficulty, pricing, tags, upvotes, review scores, and more — so you always find what you need.
- **Community-Driven:** Everything is built to encourage helpfulness, kindness, and collaboration. Your feedback, reviews, and suggestions shape the site!

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.
We’re always improving and adding new features. If you have ideas or want to help, check out the Contributing section below!

You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
## Getting Started

If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts 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.
This project uses [Laravel 11](https://laravel.com/) (PHP 8.2+) as the backend framework, with [Inertia.js](https://inertiajs.com/) and [Vue 3](https://vuejs.org/) for the frontend.

## Laravel Sponsors
### Laravel Sail

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
We use [Laravel Sail](https://laravel.com/docs/11.x/sail) for easy setup and configuration. You will need to install [Docker Desktop](https://www.docker.com/products/docker-desktop/) to use Sail.
For detailed instructions, see the [Laravel Sail documentation](https://laravel.com/docs/11.x/installation#docker-installation-using-sail).

### Premium Partners

- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[WebReinvent](https://webreinvent.com/)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Jump24](https://jump24.co.uk)**
- **[Redberry](https://redberry.international/laravel/)**
- **[Active Logic](https://activelogic.com)**
- **[byte5](https://byte5.de)**
- **[OP.GG](https://op.gg)**
### Installation

## Contributing
1. **Clone the repository:**
```bash
git clone https://github.com/AllanKoder/ComputerScienceResources.com.git
cd ComputerScienceResources.com
```
2. **Install PHP dependencies:**
```bash
composer install
```
3. **Install JS dependencies (via Sail):**
```bash
./sail npm install
```
4. **Copy and configure your environment:**
```bash
cp .env.example .env
# Edit .env to match your database and mail settings
```
5. **Generate app key:**
```bash
./sail artisan key:generate
```
6. **Run migrations:**
```bash
./sail artisan migrate
```
7. **Start the dev server:**
```bash
./sail npm run dev
# In another terminal:
./sail up
```

Great, you should now see the webapp located in `localhost`

## Style Guide

We follow the [Laravel naming conventions](https://webdevetc.com/blog/laravel-naming-conventions/) for controllers, models, migrations, and more. Please:

### Casing

- Use `PascalCase` for class names (e.g., `ResourceReviewProcessed`).
- Use `snake_case` for database columns, migration files, and fields in request bodies.
- Use `camelCase` for variable and method names.
- Use `kebab-case` for vue prop inputs to components.

### Conventions
- Place business logic in Service classes or Actions, not controllers.
- Keep controllers thin and focused on HTTP concerns.
- Use [PSR-12](https://www.php-fig.org/psr/psr-12/) code style (enforced by Pint).

**Frontend:**
- Use [Vue 3](https://vuejs.org/) with [Inertia.js](https://inertiajs.com/)
- Use [Tailwind CSS](https://tailwindcss.com/) for styling
- Use Components from the `resources/js/Components` folder whenever possible. Such as `PrimaryButton.vue` and `SecondaryButton.vue`.
- Use `primary` and `secondary` colors for classes over raw hex values according to tailwind.config.js
- Example: class='bg-primary'

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Packages Used & Why

## Code of Conduct
This project uses several Laravel and community packages to enhance functionality:

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).
- **cviebrock/eloquent-sluggable**: For generating SEO-friendly slugs for resources
- **inertiajs/inertia-laravel**: Enables server-driven SPA with Vue 3
- **joelbutcher/socialstream**: Social authentication (OAuth, etc.)
- **laravel/jetstream**: Authentication scaffolding and team management
- **laravel/sanctum**: API token authentication
- **shiftonelabs/laravel-cascade-deletes**: Handles cascading deletes for related models
- **spatie/laravel-activitylog**: Logs user activity for auditing and transparency
- **spatie/laravel-tags**: Flexible tagging for resources
- **tightenco/ziggy**: Exposes Laravel routes to JavaScript

**Dev Packages:**
- **barryvdh/laravel-debugbar**: Debugging and profiling
- **barryvdh/laravel-ide-helper**: IDE autocompletion for Laravel
- **beyondcode/laravel-query-detector**: Detects N+1 query issues
- **laravel/pint**: Automated code style fixing
- **laravel/telescope**: Debugging and monitoring (local/dev only)
- **worksome/request-factories**: Test request factories


See `composer.json` for the full list and version constraints.

## Running Tests

To run the test suite, use:

```bash
./sail test
```

By default, all tests are run. To speed up testing, you can exclude the slowest group (marked with `@Group('slow')`):

```bash
./sail test --exclude-group=slow
```

You can also run a specific test file or method:

```bash
./sail test tests/Feature/ResourceReviewsTest.php
```

## Local Debugging with Xdebug & VS Code

Xdebug is pre-configured in the Sail Docker environment for local debugging.

1. **Ensure Xdebug is enabled:**
- By default, Xdebug is enabled in Sail via the `SAIL_XDEBUG_MODE` and `SAIL_XDEBUG_CONFIG` environment variables in your `.env` file.
2. **VS Code Setup:**
- Install the [PHP Debug extension](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug).
- Add a launch configuration to your `.vscode/launch.json`:

```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceFolder}"
}
}
]
}
```

3. **Start debugging:**
- Set breakpoints in your PHP code.
- Start the "Listen for Xdebug" configuration in VS Code.
- Trigger a request (web, test, or CLI) and Xdebug will connect to VS Code.


## Documentation

- [Project Roadmap](docs/ROADMAP.md): See the planned phases and milestones for the project.
- [Application Routes & UI Previews](docs/ROUTES.md): Browse all main routes and their associated UI images.

## Contributing

## Security Vulnerabilities
We welcome contributions! Please open issues or pull requests. For suggestions of features, please use the Discussions tab.

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).
This project is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
3 changes: 2 additions & 1 deletion app/Http/Controllers/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function store(StoreCommentRequest $request)
} catch (ValidationException $e) {
DB::rollBack();
throw $e; // Let Laravel handle validation errors (422)
} catch(NotFoundHttpException $e) {
} catch (NotFoundHttpException $e) {
DB::rollBack();
Log::warning('Comment target not found', [
'error' => $e->getMessage(),
Expand All @@ -73,6 +73,7 @@ public function store(StoreCommentRequest $request)
'validated_data' => $validatedData,
'user_id' => Auth::id(),
]);

return response()->json(['message' => 'Failed to save comment'], 500);
}
}
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/ComputerScienceResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public function store(StoreResourceRequest $request)
'user_id' => Auth::id(),
'data' => $validatedData,
]);

return back()->withErrors(['error' => 'Failed to create resource. Please try again.']);
}
}
Expand Down
5 changes: 3 additions & 2 deletions app/Http/Controllers/ResourceEditsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
use App\Services\DataNormalizationService;
use App\Services\ResourceEditsService;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Inertia\Inertia;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Inertia\Inertia;
use Str;
use Throwable;

Expand Down Expand Up @@ -178,6 +178,7 @@ public function merge(ResourceEditsService $editsService, ResourceEdits $resourc
'trace' => $e->getTraceAsString(),
'resource_edit_id' => $resourceEdits->id,
]);

return redirect()->back()->withErrors(['error' => 'Failed to merge resource edits. Please try again.']);
}
}
Expand Down
6 changes: 5 additions & 1 deletion app/Http/Controllers/UpvoteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use App\Services\ModelResolverService;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Rule;
use Throwable;

class UpvoteController extends Controller
Expand Down Expand Up @@ -42,6 +42,7 @@ public function upvote($typeKey, $id)
'type_key' => $typeKey,
'id' => $id,
]);

return response()->json(['message' => 'Model not found'], 404);
}

Expand Down Expand Up @@ -70,6 +71,7 @@ public function upvote($typeKey, $id)
'id' => $id,
'user_id' => Auth::id(),
]);

return response()->json(['message' => 'Failed to upvote. Please try again.'], 500);
}
}
Expand Down Expand Up @@ -98,6 +100,7 @@ public function downvote($typeKey, $id)
'type_key' => $typeKey,
'id' => $id,
]);

return response()->json(['message' => 'Model not found'], 404);
}

Expand Down Expand Up @@ -126,6 +129,7 @@ public function downvote($typeKey, $id)
'id' => $id,
'user_id' => Auth::id(),
]);

return response()->json(['message' => 'Failed to downvote. Please try again.'], 500);
}
}
Expand Down
1 change: 1 addition & 0 deletions app/Models/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Comment extends Model

/** @use HasFactory<\Database\Factories\CommentFactory> */
use HasFactory;

use HasVotes;
use LogsActivity;

Expand Down
Loading