Change image url to images
This commit is contained in:
parent
767946aaa8
commit
796072e37a
@ -22,7 +22,7 @@ class ProjectResource extends JsonResource
|
||||
'title' => $this->title,
|
||||
'categories' => $this->categories,
|
||||
'author' => $this->author,
|
||||
'image_url' => $this->image_url,
|
||||
'images' => $this->images,
|
||||
'release_data' => $this->release_data,
|
||||
'project_url' => $this->project_url,
|
||||
'project_version' => $this->project_version,
|
||||
|
@ -13,8 +13,9 @@ use Illuminate\Support\Carbon;
|
||||
* @property string $title
|
||||
* @property array $categories
|
||||
* @property string $author
|
||||
* @property string $image_url
|
||||
* @property Carbon $release_data
|
||||
* @property array $images
|
||||
* @property Carbon $release_date
|
||||
* @property Carbon $update_date
|
||||
* @property string $project_url
|
||||
* @property string $project_version
|
||||
* @property string $description
|
||||
@ -30,7 +31,7 @@ class Project extends Model
|
||||
'title' => 'string',
|
||||
'categories' => 'array',
|
||||
'author' => 'string',
|
||||
'image_url' => 'string',
|
||||
'images' => 'array',
|
||||
'release_data' => 'datetime:d-m-Y',
|
||||
'project_url' => 'string',
|
||||
'project_version' => 'string',
|
||||
|
@ -8,6 +8,7 @@ use App\Http\Resources\ProjectCollection;
|
||||
use App\Http\Resources\ProjectResource;
|
||||
use App\Models\Project;
|
||||
use App\Repository\Interfaces\ProjectRepository as ProjectRepositoryInterface;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class ProjectRepository implements ProjectRepositoryInterface
|
||||
{
|
||||
@ -33,4 +34,21 @@ class ProjectRepository implements ProjectRepositoryInterface
|
||||
return new ProjectResource($project);
|
||||
}
|
||||
|
||||
public function add(array $data)
|
||||
{
|
||||
$this->project
|
||||
->query()
|
||||
->create([
|
||||
'title' => $data['title'],
|
||||
'categories' => $data['categories'],
|
||||
'author' => $data['author'],
|
||||
'images' => $data['images'],
|
||||
'release_date' => Carbon::createFromFormat('Y-d-m', $data['release_date']),
|
||||
'update_date' => Carbon::createFromFormat('Y-d-m', $data['update_date']),
|
||||
'project_url' => $data['project_url'],
|
||||
'project_version' => $data['project_version'],
|
||||
'description' => $data['description']
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,8 +21,9 @@ class CreateProjectsTable extends Migration
|
||||
$table->string('title', 255);
|
||||
$table->json('categories')->nullable()->default(null);
|
||||
$table->string('author', 30);
|
||||
$table->string('image_url', 30)->nullable()->default(null);
|
||||
$table->dateTimeTz('release_data')->nullable()->useCurrent();
|
||||
$table->json('images')->nullable()->default('{"small":"","medium":"","large":""}');
|
||||
$table->dateTimeTz('release_date')->nullable()->useCurrent();
|
||||
$table->dateTimeTz('update_date')->nullable()->default(null);
|
||||
$table->string('project_url', 255)->nullable()->default(null);
|
||||
$table->string('project_version', 20)->nullable()->default(null);
|
||||
$table->text('description')->nullable()->default(null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user