Skip to content

Commit

Permalink
fix: remove wrong style at post image
Browse files Browse the repository at this point in the history
  • Loading branch information
yilanboy committed Jan 2, 2025
1 parent e42980e commit ea7362e
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 142 deletions.
7 changes: 6 additions & 1 deletion app/Http/Controllers/Api/UploadImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Rules\File;
use Random\RandomException;

Expand All @@ -27,7 +28,11 @@ public function __construct(
public function __invoke(Request $request): JsonResponse
{
$validator = Validator::make($request->all(), [
'upload' => ['required', File::image()->max(1024)],
'upload' => [
'required',
File::image()->max(1024),
Rule::dimensions()->maxWidth(1200)->maxHeight(1200),
],
]);

if ($validator->fails()) {
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function tagsJson(): Attribute
// [{"id":"2","value":"C#"},{"id":"5","value":"Dart"}]
return new Attribute(
get: fn($value) => $this->tags
->map(fn($tag) => ['id' => $tag->id, 'value' => $tag->name])
->map(fn(Tag $tag) => ['id' => $tag->id, 'value' => $tag->name])
->toJson()
);
}
Expand Down
4 changes: 2 additions & 2 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class User extends Authenticatable implements MustVerifyEmail
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
* @var list<string>
*/
protected $fillable = [
'name',
Expand All @@ -36,7 +36,7 @@ class User extends Authenticatable implements MustVerifyEmail
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
* @var list<string>
*/
protected $hidden = [
'password',
Expand Down
Loading

0 comments on commit ea7362e

Please sign in to comment.