<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>formstore Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/formstore/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/formstore/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Wed, 13 Apr 2022 16:33:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Laravel 8 Form Example Tutorial</title>
		<link>https://www.scmgalaxy.com/tutorials/laravel-8-form-example-tutorial/</link>
					<comments>https://www.scmgalaxy.com/tutorials/laravel-8-form-example-tutorial/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Mon, 24 May 2021 12:59:43 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[crud operation in laravel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[formstore]]></category>
		<category><![CDATA[laravel]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=6371</guid>

					<description><![CDATA[<p>In this tutorial i’m going to describe to create form and store data in database. Please follow some easy steps [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/laravel-8-form-example-tutorial/">Laravel 8 Form Example Tutorial</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph" id="e1f0">In this tutorial i’m going to describe to create form and store data in database. Please follow some easy steps mentioned below.</p>



<h1 class="wp-block-heading" id="0a64">How to Submit Form Data into Database in Laravel 8</h1>



<ul class="wp-block-list"><li>Step 1 — Install&nbsp;<strong>Laravel 8</strong>&nbsp;Application</li><li>Step 2 — Configuring Database using Env File</li><li>Step 3 — Create Model &amp; Migration File For Add Blog Post Form</li><li>Step 4 — Create Routes</li><li>Step 5 — Creating Controller</li><li>Step 6 — Create Blade File For Add Blog Post Form</li><li>Step 7 — Start Development Server</li><li>Step 8 — Run Laravel 8 Form App On Browser</li></ul>



<h1 class="wp-block-heading" id="bc32">Step 1 — Install Laravel 8 Application</h1>



<pre class="wp-block-preformatted">composer create-project laravel/laravel laravelform</pre>



<ul class="wp-block-list"><li>Step 2 — Configuring Database using Env File</li></ul>



<p class="wp-block-paragraph" id="467e">Now create model and migration table</p>



<pre class="wp-block-preformatted">php artisan make:model Post -m</pre>



<p class="wp-block-paragraph" id="349a">Next go to post migration table and paste below code</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>use Illuminate\Database\Migrations\Migration;<br>use Illuminate\Database\Schema\Blueprint;<br>use Illuminate\Support\Facades\Schema;<br><br>class CreatePostsTable extends Migration<br>{<br>    /**<br>     * Run the migrations.<br>     *<br>     * @return void<br>     */<br>    public function up()<br>    {<br>        Schema::create('posts', function (Blueprint $table) {<br>            $table-&gt;id();<br>            $table-&gt;string('title');<br>            $table-&gt;string('description');<br>            $table-&gt;timestamps();<br>        });<br>    }<br><br>    /**<br>     * Reverse the migrations.<br>     *<br>     * @return void<br>     */<br>    public function down()<br>    {<br>        Schema::dropIfExists('posts');<br>    }<br>}</pre>



<p class="wp-block-paragraph" id="b14f">Next go to Post model and paste below code</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>namespace App;<br><br>use Illuminate\Database\Eloquent\Model;<br><br>class Post extends Model<br>{<br>    protected $fillable=[<br>        'title',<br>        'description'<br>    ];<br>}</pre>



<p class="wp-block-paragraph" id="7367">Now migrate the table run below command</p>



<pre class="wp-block-preformatted">php artisan migrate</pre>



<h1 class="wp-block-heading" id="f679">Step 4 — Create Routes</h1>



<pre class="wp-block-preformatted">&lt;?php<br><br>use Illuminate\Support\Facades\Route;<br><br>/*<br>|--------------------------------------------------------------------------<br>| Web Routes<br>|--------------------------------------------------------------------------<br>|<br>| Here is where you can register web routes for your application. These<br>| routes are loaded by the RouteServiceProvider within a group which<br>| contains the "web" middleware group. Now create something great!<br>|<br>*/<br><br>Route::get('/', function () {<br>    return view('welcome');<br>});<br><br>Route::get('add-blog-post-form', [PostController::class, 'index']);<br>Route::post('store-form', [PostController::class, 'store']);</pre>



<h1 class="wp-block-heading" id="871c">Step 5 — Creating Controller</h1>



<pre class="wp-block-preformatted">php artisan make:controller PostController -r</pre>



<p class="wp-block-paragraph" id="fd0a">Go to your Post controller file and paste below code</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>namespace App\Http\Controllers;<br><br>use Illuminate\Http\Request;use App\Post;class PostController extends Controller<br>{<br>    /**<br>     * Display a listing of the resource.<br>     *<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function index()<br>    {<br>        return view('add-blog-post-form');<br>    }<br><br>    /**<br>     * Show the form for creating a new resource.<br>     *<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function create()<br>    {<br>        //<br>    }<br><br>    /**<br>     * Store a newly created resource in storage.<br>     *<br>     * @param  \Illuminate\Http\Request  $request<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function store(Request $request)<br>    {<br>        $post = new Post;<br><br>        $post-&gt;title = $request-&gt;title;<br>        $post-&gt;description = $request-&gt;description;<br><br>        $post-&gt;save();<br><br>        return redirect('add-blog-post-form')-&gt;with('status', 'Blog Post Form Data Has Been inserted');<br>    }<br><br>    /**<br>     * Display the specified resource.<br>     *<br>     * @param  int  $id<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function show($id)<br>    {<br>        //<br>    }<br><br>    /**<br>     * Show the form for editing the specified resource.<br>     *<br>     * @param  int  $id<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function edit($id)<br>    {<br>        //<br>    }<br><br>    /**<br>     * Update the specified resource in storage.<br>     *<br>     * @param  \Illuminate\Http\Request  $request<br>     * @param  int  $id<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function update(Request $request, $id)<br>    {<br>        //<br>    }<br><br>    /**<br>     * Remove the specified resource from storage.<br>     *<br>     * @param  int  $id<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function destroy($id)<br>    {<br>        //<br>    }<br>}</pre>



<h1 class="wp-block-heading" id="eb18">Step 6 — Create Blade File For Form</h1>



<pre class="wp-block-preformatted">add-blog-post-form.blade.php</pre>



<p class="wp-block-paragraph" id="24fd">Go to Resources/views/add-blog-post-form.blade.php and create this file</p>



<pre class="wp-block-preformatted">&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;title&gt;Laravel 8 Form Example Tutorial laravel Amit&lt;/title&gt;<br>    &lt;meta name="csrf-token" content="{{ csrf_token() }}"&gt;<br><br>    &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"&gt;<br><br>&lt;/head&gt;<br>&lt;body&gt;<br><br>&lt;div class="container mt-4"&gt;<br><br>  @if(session('status'))<br>    &lt;div class="alert alert-success"&gt;<br>        {{ session('status') }}<br>    &lt;/div&gt;<br>  @endif<br><br>  &lt;div class="card"&gt;<br>    &lt;div class="card-header text-center font-weight-bold"&gt;<br>      Laravel 8 - Add Blog Post Form Example<br>    &lt;/div&gt;<br>    &lt;div class="card-body"&gt;<br>      &lt;form name="add-blog-post-form" id="add-blog-post-form" method="post" action="{{url('store-form')}}"&gt;<br>       @csrf<br><br>        &lt;div class="form-group"&gt;<br>          &lt;label for="exampleInputEmail1"&gt;Title&lt;/label&gt;<br>          &lt;input type="text" id="title" name="title" class="form-control" required=""&gt;<br>        &lt;/div&gt;<br><br>        &lt;div class="form-group"&gt;<br>          &lt;label for="exampleInputEmail1"&gt;Description&lt;/label&gt;<br>          &lt;textarea name="description" class="form-control" required=""&gt;&lt;/textarea&gt;<br>        &lt;/div&gt;<br><br>        &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;<br>      &lt;/form&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;    <br>&lt;/body&gt;<br>&lt;/html&gt;</pre>



<p class="wp-block-paragraph" id="a30c">Now refresh the Browser</p>



<pre class="wp-block-preformatted">php artisan serve</pre>



<p class="wp-block-paragraph" id="f3de">When you fire the above given url on browser, you will look like in the following image:</p>



<pre class="wp-block-preformatted">http://127.0.0.1:8000/add-blog-post-form</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1359/1*dcLBw6pyf6tdD7kkFG7smA.png" alt=""/></figure>



<p class="wp-block-paragraph" id="4645">Thanks</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/laravel-8-form-example-tutorial/">Laravel 8 Form Example Tutorial</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/laravel-8-form-example-tutorial/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
