diff --git a/project/app/Actions/Fortify/CreateNewUser.php b/project/app/Actions/Fortify/CreateNewUser.php index a9f1653..f40ab87 100644 --- a/project/app/Actions/Fortify/CreateNewUser.php +++ b/project/app/Actions/Fortify/CreateNewUser.php @@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Validator; use Laravel\Fortify\Contracts\CreatesNewUsers; use Laravel\Jetstream\Jetstream; +use App\Http\Requests\Request; class CreateNewUser implements CreatesNewUsers { @@ -21,11 +22,11 @@ class CreateNewUser implements CreatesNewUsers public function create(array $input) { Validator::make($input, [ - 'name' => ['required', 'string', 'max:255'], + 'name' => ['required', 'string', 'alpha_dash', 'max:32', 'unique:users'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'password' => $this->passwordRules(), 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '', - ])->validate(); + ], ['alpha_dash' => 'The user name must be a single word'])->validate(); return User::create([ 'name' => $input['name'], diff --git a/project/app/Actions/Fortify/UpdateUserProfileInformation.php b/project/app/Actions/Fortify/UpdateUserProfileInformation.php index c757632..4f68695 100644 --- a/project/app/Actions/Fortify/UpdateUserProfileInformation.php +++ b/project/app/Actions/Fortify/UpdateUserProfileInformation.php @@ -19,7 +19,7 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation public function update($user, array $input) { Validator::make($input, [ - 'name' => ['required', 'string', 'max:255'], + 'name' => ['required', 'string', 'alpha_dash', 'max:32', 'unique:users'], 'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)], 'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'], ])->validateWithBag('updateProfileInformation'); diff --git a/project/app/Http/Controllers/PostController.php__ b/project/app/Http/Controllers/PostController.php__ deleted file mode 100644 index 7513d0f..0000000 --- a/project/app/Http/Controllers/PostController.php__ +++ /dev/null @@ -1,107 +0,0 @@ -route('index'); - } - - /** - * Display the specified resource. - * - * @param \App\Models\Post $post - * @return \Illuminate\Http\Response - */ - // public function show(int $postId) - // { - - // $post = Post::where('id', $postId)->first(); - - // return view('front.show', compact('post')); - // } - - // public function show($id) - // { - // return view('front.show', [ - // 'post' => Post::findOrFail($id) - // ]); - // } - - /** - * Show the form for editing the specified resource. - * - * @param \App\Models\Post $post - * @return \Illuminate\Http\Response - */ - public function edit(Post $post) - { - // - } - - /** - * Update the specified resource in storage. - * - * @param \Illuminate\Http\Request $request - * @param \App\Models\Post $post - * @return \Illuminate\Http\Response - */ - public function update(Request $request, Post $post) - { - // - } - - /** - * Remove the specified resource from storage. - * - * @param \App\Models\Post $post - * @return \Illuminate\Http\Response - */ - public function destroy(Post $post) - { - // - } - - - // public function home() - // { - // return view('welcome'); - // } - - // public function toUserLogout() - // { - // return view('front.logout'); - // } -} diff --git a/project/app/Http/Livewire/NewPost.php b/project/app/Http/Livewire/NewPost.php index 988668f..72e0ff0 100644 --- a/project/app/Http/Livewire/NewPost.php +++ b/project/app/Http/Livewire/NewPost.php @@ -23,8 +23,8 @@ class NewPost extends Component public $rules = [ 'description' => 'required|min:3|max:255', - 'user_id' => 'required', - 'photo' => 'nullable|image|max:1024' + // 'user_id' => 'required', + 'photo' => 'nullable|image|max:512|dimensions:min_width=500,min_height=500,max_width=1500,max_height=1500' ]; public function render() @@ -45,7 +45,7 @@ public function save(Request $request) if ($this->photo == null) { $filename = null; } else { - $filename = $this->photo->store('photos1'); + $filename = $this->photo->store('public'); } $this->validate(); diff --git a/project/resources/views/admin/posts.blade.php b/project/resources/views/admin/posts.blade.php index 9f4162e..d375651 100644 --- a/project/resources/views/admin/posts.blade.php +++ b/project/resources/views/admin/posts.blade.php @@ -21,15 +21,15 @@
@if ($post->image) image") }}"> - image") }}" + image") }}" alt="#"> @endif
- User name: {{ $post->user->name }}
+ class="font-extrabold text-gray-900 text-xl leading-tight font-medium mb-2 flex items-center truncate"> + User name:
{{ $post->user->name }} Is it visible: diff --git a/project/resources/views/admin/show-post.blade.php b/project/resources/views/admin/show-post.blade.php index af826c4..20cc73b 100644 --- a/project/resources/views/admin/show-post.blade.php +++ b/project/resources/views/admin/show-post.blade.php @@ -17,8 +17,8 @@
- User name: {{ $post->user->name }}
+ class="font-extrabold text-gray-900 text-xl leading-tight font-medium mb-2 flex items-center truncate"> + User name:
{{ $post->user->name }} Is it visible: ID: {{ $post->id }} diff --git a/project/resources/views/admin/show-user.blade.php b/project/resources/views/admin/show-user.blade.php index 5670f55..12be177 100644 --- a/project/resources/views/admin/show-user.blade.php +++ b/project/resources/views/admin/show-user.blade.php @@ -3,10 +3,10 @@
-
+
- Name: {{ $user->name }} + class="text-center text-gray-900 text-base font-extrabold leading-tight font-medium mb-2 border-b-2 pb-2 truncate "> + Name:
{{ $user->name }}

@@ -22,16 +22,13 @@ class="text-center text-gray-900 text-base font-extrabold leading-tight font-med

-
+
ID: {{ $user->id }}
-
+
mail: {{ $user->email }}
-
+
Created:
{{ $user->created_at }}
diff --git a/project/resources/views/admin/users.blade.php b/project/resources/views/admin/users.blade.php index 88e358c..50987eb 100644 --- a/project/resources/views/admin/users.blade.php +++ b/project/resources/views/admin/users.blade.php @@ -14,8 +14,8 @@ @foreach ($users as $user)
-
-
Name: {{ $user->name }} +
+
Name:
{{ $user->name }}

diff --git a/project/resources/views/front/show.blade.php b/project/resources/views/front/show.blade.php index 4ff3264..d917b7f 100644 --- a/project/resources/views/front/show.blade.php +++ b/project/resources/views/front/show.blade.php @@ -10,11 +10,11 @@

-
{{ $post->user->name }}
+
{{ $post->user->name }}

{{ $post->description }}

- image") }}" alt=""> + image") }}" alt="#">
diff --git a/project/resources/views/livewire/all-posts.blade.php b/project/resources/views/livewire/all-posts.blade.php index c8768ce..999affb 100644 --- a/project/resources/views/livewire/all-posts.blade.php +++ b/project/resources/views/livewire/all-posts.blade.php @@ -2,13 +2,13 @@ @foreach ($posts as $post)
-
{{ $post->user->name }}
+
{{ $post->user->name }}

{{ $post->description }}

@if ($post->image) image") }}"> - image") }}" alt="#" width="100%"> + image") }}" alt="#" width="100%" style="max-height:100vh"> @endif diff --git a/project/resources/views/livewire/new-post.blade.php b/project/resources/views/livewire/new-post.blade.php index 54d3f73..4333e66 100644 --- a/project/resources/views/livewire/new-post.blade.php +++ b/project/resources/views/livewire/new-post.blade.php @@ -13,10 +13,9 @@ class="block p-6 rounded-lg shadow-lg bg-[#1F2C3C] w-64 max-w-sm md:max-w-lg sm: - @error('description')
{{ $message }} diff --git a/project/resources/views/navigation-menu-user.blade.php b/project/resources/views/navigation-menu-user.blade.php index 5e90db2..0b008c6 100644 --- a/project/resources/views/navigation-menu-user.blade.php +++ b/project/resources/views/navigation-menu-user.blade.php @@ -32,7 +32,7 @@