fix(backend): harden sanctum auth, remove dead models, add composite indexes and optimize homepage queries
Deploy Backend / deploy (push) Successful in 48s

This commit is contained in:
Parsa Aghayi committed 2026-11-02 13:00:24 +00:00
1 parent 5e6647d812
commit accf0b6aab
8 files changed
+71 -75

No files matched your search

-30
View File
@@ -1,30 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use App\Models\Project;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Project>
*/
class ProjectFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
protected $model = Project::class;
public function definition(): array
{
return [
'title' => $this->faker->sentence,
'category' => $this->faker->randomElement(['Web Design', 'App Design', 'Graphic Design', 'Front End', 'Back End']),
'images' => json_encode([
['src' => $this->faker->imageUrl(), 'position' => 'bottom-[-5px] left-[-5px]', 'zIndex' => 20],
['src' => $this->faker->imageUrl(), 'position' => 'top-[-5px] right-[-5px]', 'zIndex' => 10],
]),
];
}
}
@@ -0,0 +1,32 @@
<?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::table('posts', function (Blueprint $table) {
$table->index(['published_at', 'views'], 'posts_published_at_views_idx');
$table->index(['category_id', 'published_at'], 'posts_category_id_published_at_idx');
$table->index(['author_id', 'published_at'], 'posts_author_id_published_at_idx');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('posts', function (Blueprint $table) {
$table->dropIndex('posts_published_at_views_idx');
$table->dropIndex('posts_category_id_published_at_idx');
$table->dropIndex('posts_author_id_published_at_idx');
});
}
};