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 @@
@@ -22,16 +22,13 @@ class="text-center text-gray-900 text-base font-extrabold leading-tight font-med
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->description }}
-{{ $post->description }}
@if ($post->image) image") }}"> -