Skip to content

Commit

Permalink
fix preview main image
Browse files Browse the repository at this point in the history
  • Loading branch information
gheorghelupu17 committed Oct 16, 2023
1 parent 140e41b commit c1ab56f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions app/Http/Controllers/Dashboard/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
use App\Http\Controllers\Controller;
use App\Http\Requests\Project\StoreRequest;
use App\Http\Resources\Project\EditProjectResource;
use App\Http\Resources\Project\ShowProjectResource;
use App\Http\Resources\ProjectCardResource;
use App\Models\Activity;
use App\Models\County;
use App\Models\Project;
use App\Models\ProjectCategory;
use App\Services\ProjectService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
Expand Down Expand Up @@ -83,17 +80,16 @@ public function update(Request $request, Project $project)
{
$this->authorize('editAsNgo', $project);


if ($request->has('counties')) {
$project->counties()->sync(collect($request->get('counties')));
}
if ($request->has('categories')) {
$project->categories()->sync(collect($request->get('categories')));
}
// dd($request->all());
if ($request->has('image')) {
$project->addMediaFromRequest('image')->toMediaCollection('preview');
}
// dd($request->all());
$project->update($request->all());

return redirect()->back()
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Pages/AdminOng/Projects/EditProject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
<Field :label="$t('main_image')" :hasPendingChanges="changes.includes('cover_image')" :errors="formChangeStatus.errors.image">
<template #value>
<div class="flex items-center col-span-12 gap-6 text-base font-medium leading-6 text-gray-700">
<img class="object-contain w-32 h-32 shrink-0" :src="project.image" alt="" />
<img class="object-contain w-32 h-32 shrink-0" :src="originalProject.image" alt="" />

<div>
<EditModal
Expand All @@ -274,7 +274,7 @@
>
<FileInput
:label="$t('upload_image')"
@upload="(file) => (project.image = file)"
@upload="(file) =>(project.image = file)"
:form="project.image"
accept="image/png, image/jpeg"
previewable
Expand Down

0 comments on commit c1ab56f

Please sign in to comment.