Merhaba,Sitenizi aktif olarak kullanmaktayım ve hatalarım karşısında siz bilen insanlara sormaktan çekinmiyorum.Sizler iyiki varsınız.Bir başka sorun ile karşı karşıyayım.Aşağıda tüm açıklamaları yaptım
Ben Store yani kullanıcı hikaye göndermeden önce E-mail doğrulamasını istiyorum.Uğraştım ancak takıldım ve yapamadım.
web.php
<?php
use App\Http\Controllers\HomeController;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', [HomeController::class, 'index'])
->name('index');
Route::get('viral', [HomeController::class, 'viral'])
->name('viral');
Route::get('random', [HomeController::class, 'random'])
->name('random');
Route::get('search', [HomeController::class, 'search'])
->name('search');
Route::get('view/{id}/{slug}', [HomeController::class, 'show'])
->name('show');
Route::group(['middleware' => ['auth']], function () {
Route::post('write', [HomeController::class, 'store'])
->name('store');
Route::post('save_like', [HomeController::class, 'save_like'])
->name('save_like');
Route::post('save_favorite', [HomeController::class, 'save_favorite'])
->name('save_favorite');
Route::get('post/delete/{id}', [HomeController::class, 'delete_user_post'])
->name('delete_user_post');
// report
Route::get('report/{id}', [HomeController::class, 'report'])
->name('report');
});
require __DIR__.'/gender.php';
require __DIR__.'/points.php';
require __DIR__.'/comments.php';
require __DIR__.'/categories.php';
require __DIR__.'/pages.php';
require __DIR__.'/tags.php';
require __DIR__.'/admin.php';
require __DIR__.'/auth.php';
auth.php
<?php
use App\Http\Controllers\Auth\AuthenticatedSessionController;
use App\Http\Controllers\Auth\ConfirmablePasswordController;
use App\Http\Controllers\Auth\EmailVerificationNotificationController;
use App\Http\Controllers\Auth\EmailVerificationPromptController;
use App\Http\Controllers\Auth\NewPasswordController;
use App\Http\Controllers\Auth\PasswordResetLinkController;
use App\Http\Controllers\Auth\RegisteredUserController;
use App\Http\Controllers\Auth\VerifyEmailController;
use App\Http\Controllers\Auth\AccountController;
use Illuminate\Support\Facades\Route;
Route::get('/register', [RegisteredUserController::class, 'create'])
->middleware('guest')
->name('register');
Route::post('/register', [RegisteredUserController::class, 'store'])
->middleware('guest');
Route::get('/login', [AuthenticatedSessionController::class, 'create'])
->middleware('guest')
->name('login');
Route::post('/login', [AuthenticatedSessionController::class, 'store'])
->middleware('guest');
Route::get('/forgot-password', [PasswordResetLinkController::class, 'create'])
->middleware('guest')
->name('password.request');
Route::post('/forgot-password', [PasswordResetLinkController::class, 'store'])
->middleware('guest')
->name('password.email');
Route::get('/reset-password/{token}', [NewPasswordController::class, 'create'])
->middleware('guest')
->name('password.reset');
Route::post('/reset-password', [NewPasswordController::class, 'store'])
->middleware('guest')
->name('password.update');
Route::get('/verify-email', [EmailVerificationPromptController::class, '__invoke'])
->middleware('auth')
->name('verification.notice');
Route::get('/verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke'])
->middleware(['auth', 'signed', 'throttle:6,1'])
->name('verification.verify');
Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
->middleware(['auth', 'throttle:6,1'])
->name('verification.send');
Route::get('/confirm-password', [ConfirmablePasswordController::class, 'show'])
->middleware('auth')
->name('password.confirm');
Route::post('/confirm-password', [ConfirmablePasswordController::class, 'store'])
->middleware('auth');
Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
->middleware('auth')
->name('logout');
Route::get('/settings/edit', [AccountController::class, 'settings'])
->middleware('auth');
Route::post('/settings/edit', [AccountController::class, 'store'])
->middleware('auth');
Route::get('/settings/avatar/delete', [AccountController::class, 'avatar_delete'])
->middleware('auth');
Route::get('/notifications', [AccountController::class, 'notifications'])
->middleware('auth');
Route::post('/mark-as-read', [AccountController::class, 'mark_as_read'])
->middleware('auth');
Route::get('/favorites', [AccountController::class, 'favorites'])
->middleware('auth');
Route::get('/profile/@{username}', [AccountController::class, 'profile'])
->name('profile');
Route::get('/profile/@{username}/comments', [AccountController::class, 'user_comments'])
->name('user_comments');
Route::get('/settings/delete/me', [AccountController::class, 'delete_account'])
->middleware('auth');
Route::post('/settings/delete/me', [AccountController::class, 'delete_account_store'])
->middleware('auth')
->name('delete_account_store');
HomeController.php (Store)
public function store(Request $request)
{
if(Settings::find('active_upload')->value == 0){
toastr()->warning(__('main.new_entries_paused'));
return redirect('/');
}
$rules = [
'title' => 'required|string|max:255',
'story' => 'required|string|min:'.Settings::find('minimum_characters')->value.'|max:'.Settings::find('maximum_characters')->value,
'tags' => 'nullable',
'category_id' => 'required',
'genders_id' => 'required',
'age' => 'required',
'photo' => 'nullable|image|mimes:jpeg,png,jpg|max:2048'
];
if($request->hasFile('photo')) {
$rules['story'] = 'nullable';
}
Validator::make($request->all(), $rules,[
'title.required' => 'Bir Başlık Giriniz.',
'title.max' => 'Başlık 255 Karakterden Uzun Olamaz.',
'story.required' => 'Boş bırakılmamalıdır.',
'story.min' => 'Girilen Metin '.Settings::find('minimum_characters')->value.' Karakterden Fazla Olmalıdır.',
'story.max' => 'Girilen Metin ' .Settings::find('maximum_characters')->value.' Karakterden Az Olmalıdır.',
'category_id.required' => 'Kategori Seçmeniz Gerekiyor.',
'photo.image' => 'Lütfen Resim Dosyası Yükleyiniz.',
'photo.mimes' => 'Dosya Biçimi jpg,png veya jpeg olmalıdır.',
])->validateWithBag('write');
// if word censored is active
if(Settings::find('words_censored')->value == 1) {
$censor = new CensorWords;
$badwords = $censor->setDictionary(base_path('/vendor/snipe/banbuilder/src/dict/dictionary.php'));
$string = $censor->censorString($request->story)['clean'];
} else {
$string = $request->story;
}
//
// create item
$create_item = Items::create([
'title' => $request->title,
'story' => $string,
'slug' => Str::slug($request->title),
'status' => Settings::find('new_entries')->value,
'user_id' => Auth::id(),
'category_id' => $request->category_id,
'genders_id' => $request->genders_id,
'age' => $request->age,
]);
if ($create_item) {
// if exists, upload photo
if ($request->hasFile('photo')) {
// upload original
$path = $request->file('photo')->store('photos');
// store photo
$storePhoto = Photos::create([
'item_id' => $create_item->id,
'filename' => $path
]);
}
// create tags
$tags = explode(",", $request->tags);
$create_item->tag($tags);
if(Settings::find('status_points')->value == 1){
if(Settings::find('status_points_new_entry')->value == 1){
Points::create([
'user_id' => Auth::id(),
'point_type' => "new_entry",
'score' => Settings::find('points_new_entry')->value,
'item_id' => $create_item->id
]);
}
}
if(Settings::find('new_entries')->value == 1){
toastr()->success(__('main.toast_your_post_has_been_posted'));
return redirect('/');
} else {
toastr()->warning(__('main.toast_post_in_moderation'));
return redirect('/');
}
} else {
toastr()->error(__('main.toast_there_are_problems_try_again'));
return redirect('/')->withErrors($validator, 'write')->withInput();
}
}