Skip to main content

Posts

Showing posts with the label laravel accepted

Laravel Validation Accepted Example

Hi Guys, Today, I will learn you to create validation accepted in laravel.we will show example of laravel validation accepted.The field under validation must be "yes", "on", 1, or true. This is useful for validating "Terms of Service" acceptance or similar fields. Here, I will give you full example for simply accepted validation in laravel bellow. solution $request->validate([ 'terms' => 'accepted', ]); Route : routes/web.php Route::get('form/create','FromController@index'); Route::post('form/store','FromController@store')->name('form.store'); Controller : app/Http/Controllers/BlogController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Blade; use App\Models\User; use App\Models\Post; class FromController extends Controller { /** * Write code on Method * * @return response() */ public function crea