Project support has been updated
This commit is contained in:
parent
db09f170a0
commit
098bab32e9
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Repository\Interfaces\ProjectRepository;
|
||||
@ -14,12 +16,12 @@ class ProjectController extends Controller
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
return $this->projectRepository->all();
|
||||
}
|
||||
|
||||
public function show()
|
||||
public function show(int $project)
|
||||
{
|
||||
|
||||
return $this->projectRepository->get($project);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
@ -29,8 +29,7 @@ class ProjectRepository implements ProjectRepositoryInterface
|
||||
{
|
||||
$project = $this->project
|
||||
->query()
|
||||
->find($id)
|
||||
->first();
|
||||
->findOrFail($id);
|
||||
return new ProjectResource($project);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -17,13 +19,13 @@ class CreateProjectsTable extends Migration
|
||||
Schema::create('projects', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title', 255);
|
||||
$table->json('categories');
|
||||
$table->json('categories')->nullable()->default(null);
|
||||
$table->string('author', 30);
|
||||
$table->string('image_url', 30);
|
||||
$table->dateTimeTz('release_data');
|
||||
$table->string('project_url', 255);
|
||||
$table->string('project_version', 20);
|
||||
$table->text('description');
|
||||
$table->string('image_url', 30)->nullable()->default(null);
|
||||
$table->dateTimeTz('release_data')->nullable()->useCurrent();
|
||||
$table->string('project_url', 255)->nullable()->default(null);
|
||||
$table->string('project_version', 20)->nullable()->default(null);
|
||||
$table->text('description')->nullable()->default(null);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
@ -27,7 +28,7 @@ Route::prefix('category')->group(function() {
|
||||
Route::get('{category}', 'CategoryController@showWhereSlug');
|
||||
});
|
||||
|
||||
Route::get('projects', 'CategoryController@index');
|
||||
Route::get('projects', 'ProjectController@index');
|
||||
Route::prefix('project')->group(function() {
|
||||
Route::get('{project}', 'CategoryController@showWhereSlug');
|
||||
Route::get('{project}', 'ProjectController@show');
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user