-
Notifications
You must be signed in to change notification settings - Fork 17
Feature/andre floquet #37
base: main
Are you sure you want to change the base?
Feature/andre floquet #37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall a pretty clean PR 👍🏻
if(isset($post)) { | ||
session()->flash('success', "The post '{$post->name}' has been created!"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the Post::create()
operation failed an exception would be thrown, so this if condition is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree. Would be better in a try catch block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed for try catch block returning friendly user message
{ | ||
Schema::create('posts', function (Blueprint $table) { | ||
$table->id(); | ||
$table->foreignId('user_id')->constrained()->cascadeOnDelete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this means if the post is deleted, the user is also deleted? 😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually no, this looks correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, the opposite. If the user is deleted, the posts from the user are deleted too
resources/views/home.blade.php
Outdated
<div> | ||
<x-label for="image" :value="__('Upload Image')" /> | ||
|
||
<x-input-file id="image" class="block mt-1 w-full" type="file" name="image" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably move type="file"
to the file component given it is specifically a file component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I saw the input component and I copied from that as I have no much experience working with blade components, but the input can be of many types, the file input type is just file input type. You are right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
fix on input-file component and post.store. Add images .gitignore
Create Post