<?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>contact Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/contact/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/contact/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Wed, 13 Apr 2022 16:33:33 +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>Create contact form in laravel 5.8</title>
		<link>https://www.scmgalaxy.com/tutorials/create-contact-form-in-laravel-5-8/</link>
					<comments>https://www.scmgalaxy.com/tutorials/create-contact-form-in-laravel-5-8/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Sat, 10 Apr 2021 11:42:34 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[contact]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[laravel]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=5827</guid>

					<description><![CDATA[<p>In this tutorial I&#8217;m going to create contact form in laravel and store in database please follow some easy steps [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/create-contact-form-in-laravel-5-8/">Create contact form in laravel 5.8</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In this tutorial I&#8217;m going to create contact form in laravel and store in database please follow some easy steps mentioned below.</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/600/1*wX5lqtHkUhlARsoQw__BTw.png" alt="create-contact-form-in-laravel"/></figure>



<p class="wp-block-paragraph" id="be10">1 step you have to download project copy to below code and paste in command.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>composer create-project — prefer-dist laravel/laravel contact “5.8.*”</p><p><strong>2nd go to</strong>&nbsp;.env folder and put database name as :-&nbsp;<strong><em>contact</em></strong></p></blockquote>



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



<p class="wp-block-paragraph" id="c242">Next go to&nbsp;<a href="http://localhost/phpmyadmin/server_databases.php?server=1">http://localhost/phpmyadmin</a>&nbsp;and put database name&nbsp;<strong>contact&nbsp;</strong>and click on create</p>



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



<p class="wp-block-paragraph" id="af70">Next step create model and migration copy below code and simply paste</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>php artisan make:model contact -m</p></blockquote>



<p class="wp-block-paragraph" id="ed35">Go to migration folder&nbsp;<strong>create_contacts_table&nbsp;</strong>and paste this code <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p class="wp-block-paragraph" id="54f0"><strong>create_contacts_table</strong></p>



<pre class="wp-block-preformatted">&lt;?php<br><br>use Illuminate\Support\Facades\Schema;<br>use Illuminate\Database\Schema\Blueprint;<br>use Illuminate\Database\Migrations\Migration;<br><br>class CreateContactsTable extends Migration<br>{<br>    /**<br>     * Run the migrations.<br>     *<br>     * @return void<br>     */<br>    public function up()<br>    {<br>        Schema::create('contacts', function (Blueprint $table) {<br>            $table-&gt;bigIncrements('id');<br>            $table-&gt;string('name');<br>            $table-&gt;string('email');<br>            $table-&gt;string('phone');<br>            $table-&gt;string('url');<br>            $table-&gt;string('message');<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('contacts');<br>    }<br>}</pre>



<p class="wp-block-paragraph" id="d6ff">Next run this command</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>php artisan: migrate</p></blockquote>



<p class="wp-block-paragraph" id="8b89">Next go to contact model<strong>&nbsp;Contact.php&nbsp;</strong>and paste this code <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p class="wp-block-paragraph" id="3c42"><strong>Contact.php</strong></p>



<pre class="wp-block-preformatted">&lt;?php<br><br>namespace App;<br><br>use Illuminate\Database\Eloquent\Model;<br><br>class Contact extends Model<br>{<br>    protected $fillable = [ <br>        'name',<br>        'email',<br>        'phone',<br>        'url',<br>        'message'<br><br>    ];<br>}</pre>



<p class="wp-block-paragraph" id="86e5">Next create controller</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><strong>Php artisan make:controller ContactController -r</strong></p></blockquote>



<p class="wp-block-paragraph" id="f5d9">Go to ContactController and paste below code in ContactController.php</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><strong>ContactController.php</strong></p></blockquote>



<pre class="wp-block-preformatted">&lt;?php<br><br>namespace App\Http\Controllers;<br><br>use Illuminate\Http\Request;<br>use App\Contact;<br><br>class ContactController 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('contact');<br>    }<br><br>    public function thanks()<br>    {<br>        return view('thanks');<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>        <br>        $request-&gt;validate([<br>            'name' =&gt; 'required',<br>            'email' =&gt; 'required',<br>            'phone' =&gt; 'required',<br>            'url'   =&gt;  'required',<br>            'message' =&gt; 'required'<br><br>        ]);<br><br>       <br><br>        $form_data = array(<br>            'name'   =&gt; $request-&gt;name,<br>            'email'  =&gt; $request-&gt;email,<br>            'phone'  =&gt; $request-&gt;phone,<br>            'url'    =&gt; $request-&gt;url,<br>            'message' =&gt; $request-&gt;message   <br>        );<br><br>        Contact::create($form_data);<br>            return redirect('thanks')-&gt;with('success','Data Added successfully');<br><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>



<p class="wp-block-paragraph" id="c9a1">Next go to web.php and simply paste</p>



<p class="wp-block-paragraph" id="df6f"><strong>web.php</strong></p>



<pre class="wp-block-preformatted">&lt;?php<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('contact','ContactController@index');<br>Route::post('contact','ContactController@store')-&gt;name('store');<br>Route::get('thanks','ContactController@thanks');</pre>



<p class="wp-block-paragraph" id="3d1b">Next go to resources/view and create file&nbsp;<strong>contact.blade.php and simply paste this code</strong></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><strong>contact.blade.php</strong></p></blockquote>



<pre class="wp-block-preformatted">&lt;!doctype html&gt;<br>&lt;html lang="en"&gt;<br>  &lt;head&gt;<br>    &lt;!-- Required meta tags --&gt;<br>    &lt;meta charset="utf-8"&gt;<br>    &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;<br><br>    &lt;!-- Bootstrap CSS --&gt;<br>    &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"&gt;<br><br>    &lt;style&gt;<br>@import url(https://fonts.googleapis.com/css?family=Roboto:400,300,600,400italic);<br>* {<br>  margin: 0;<br>  padding: 0;<br>  box-sizing: border-box;<br>  -webkit-box-sizing: border-box;<br>  -moz-box-sizing: border-box;<br>  -webkit-font-smoothing: antialiased;<br>  -moz-font-smoothing: antialiased;<br>  -o-font-smoothing: antialiased;<br>  font-smoothing: antialiased;<br>  text-rendering: optimizeLegibility;<br>}<br><br>body {<br>  font-family: "Roboto", Helvetica, Arial, sans-serif;<br>  font-weight: 100;<br>  font-size: 12px;<br>  line-height: 30px;<br>  color: #777;<br>  background: #4CAF50;<br>}<br><br>.container {<br>  max-width: 400px;<br>  width: 100%;<br>  margin: 0 auto;<br>  position: relative;<br>}<br><br>#contact input[type="text"],<br>#contact input[type="email"],<br>#contact input[type="tel"],<br>#contact input[type="url"],<br>#contact textarea,<br>#contact button[type="submit"] {<br>  font: 400 12px/16px "Roboto", Helvetica, Arial, sans-serif;<br>}<br><br>#contact {<br>  background: #F9F9F9;<br>  padding: 25px;<br>  margin: 150px 0;<br>  box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);<br>}<br><br>#contact h3 {<br>  display: block;<br>  font-size: 30px;<br>  font-weight: 300;<br>  margin-bottom: 10px;<br>}<br><br>#contact h4 {<br>  margin: 5px 0 15px;<br>  display: block;<br>  font-size: 13px;<br>  font-weight: 400;<br>}<br><br>fieldset {<br>  border: medium none !important;<br>  margin: 0 0 10px;<br>  min-width: 100%;<br>  padding: 0;<br>  width: 100%;<br>}<br><br>#contact input[type="text"],<br>#contact input[type="email"],<br>#contact input[type="tel"],<br>#contact input[type="url"],<br>#contact textarea {<br>  width: 100%;<br>  border: 1px solid #ccc;<br>  background: #FFF;<br>  margin: 0 0 5px;<br>  padding: 10px;<br>}<br><br>#contact input[type="text"]:hover,<br>#contact input[type="email"]:hover,<br>#contact input[type="tel"]:hover,<br>#contact input[type="url"]:hover,<br>#contact textarea:hover {<br>  -webkit-transition: border-color 0.3s ease-in-out;<br>  -moz-transition: border-color 0.3s ease-in-out;<br>  transition: border-color 0.3s ease-in-out;<br>  border: 1px solid #aaa;<br>}<br><br>#contact textarea {<br>  height: 100px;<br>  max-width: 100%;<br>  resize: none;<br>}<br><br>#contact button[type="submit"] {<br>  cursor: pointer;<br>  width: 100%;<br>  border: none;<br>  background: #4CAF50;<br>  color: #FFF;<br>  margin: 0 0 5px;<br>  padding: 10px;<br>  font-size: 15px;<br>}<br><br>#contact button[type="submit"]:hover {<br>  background: #43A047;<br>  -webkit-transition: background 0.3s ease-in-out;<br>  -moz-transition: background 0.3s ease-in-out;<br>  transition: background-color 0.3s ease-in-out;<br>}<br><br>#contact button[type="submit"]:active {<br>  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);<br>}<br><br>.copyright {<br>  text-align: center;<br>}<br><br>#contact input:focus,<br>#contact textarea:focus {<br>  outline: 0;<br>  border: 1px solid #aaa;<br>}<br><br>::-webkit-input-placeholder {<br>  color: #888;<br>}<br><br>:-moz-placeholder {<br>  color: #888;<br>}<br><br>::-moz-placeholder {<br>  color: #888;<br>}<br><br>:-ms-input-placeholder {<br>  color: #888;<br>}<br>    &lt;/style&gt;<br><br>&lt;div class="container"&gt;  <br>  &lt;form id="contact" action="{{route('store')}}" method="post"&gt;<br>    @csrf<br>    &lt;div class="container"&gt;  <br>  &lt;form id="contact" action="{{route('store')}}" method="post"&gt;<br>    @csrf<br>    &lt;h3&gt;Amit Contact Form&lt;/h3&gt;<br>    &lt;h4&gt;Contact us for custom quote&lt;/h4&gt;<br>    &lt;fieldset&gt;<br>      &lt;input placeholder="Your name" type="text" tabindex="1" name="name" required autofocus&gt;<br>    &lt;/fieldset&gt;<br>    &lt;fieldset&gt;<br>      &lt;input placeholder="Your Email Address" type="email" name="email" tabindex="2" required&gt;<br>    &lt;/fieldset&gt;<br>    &lt;fieldset&gt;<br>      &lt;input placeholder="Your Phone Number (optional)" type="tel" name="phone" tabindex="3" required&gt;<br>    &lt;/fieldset&gt;<br>    &lt;fieldset&gt;<br>      &lt;input placeholder="Your Web Site (optional)" type="url" name="url" tabindex="4" required&gt;<br>    &lt;/fieldset&gt;<br>    &lt;fieldset&gt;<br>      &lt;textarea placeholder="Type your message here...." tabindex="5" name="message" required&gt;&lt;/textarea&gt;<br>    &lt;/fieldset&gt;<br>    &lt;fieldset&gt;<br>      &lt;button name="submit" type="submit" id="contact-submit" data-submit="...Sending"&gt;Submit&lt;/button&gt;<br>    &lt;/fieldset&gt;<br>  &lt;/form&gt;<br>&lt;/div&gt;&gt;<br><br>    &lt;!-- Optional JavaScript --&gt;<br>    &lt;!-- jQuery first, then Popper.js, then Bootstrap JS --&gt;<br>    &lt;script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"&gt;&lt;/script&gt;<br>    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"&gt;&lt;/script&gt;<br>    &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"&gt;&lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre>



<p class="wp-block-paragraph" id="4704">And next go to resources/view and create new file&nbsp;<strong>thanks.blade.php</strong>&nbsp;and paste below code</p>



<p class="wp-block-paragraph" id="3062"><strong>thanks.blade.php</strong></p>



<pre class="wp-block-preformatted">&lt;!doctype html&gt;<br>&lt;html lang="en"&gt;<br>  &lt;head&gt;<br>    &lt;!-- Required meta tags --&gt;<br>    &lt;meta charset="utf-8"&gt;<br>    &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;<br><br>    &lt;!-- Bootstrap CSS --&gt;<br>    &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"&gt;<br><br>    &lt;title&gt;Hello, world!&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;!-- &lt;h1&gt;Thanks for contacting us&lt;/h1&gt; --&gt;<br><br>    &lt;!-- Modal --&gt;<br>&lt;div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"&gt;<br>  &lt;div class="modal-dialog modal-dialog-centered" role="document"&gt;<br>    &lt;div class="modal-content" style="background-color: white; background-image:<br>      url(https://subtlepatterns.com/patterns/purty_wood.png);<br>  background-position: center top;<br>  background-repeat: repeat;"&gt;<br>      &lt;div class="modal-header"&gt;<br>        &lt;h5 class="modal-title text-danger" id="exampleModalLongTitle"&gt;Message&lt;/h5&gt;<br>        &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;<br>          &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;<br>        &lt;/button&gt;<br>      &lt;/div&gt;<br>      &lt;div class="modal-body"&gt;<br>&lt;span&gt;<br> Thanks for contacting us<br>  &lt;/span&gt;<br>      &lt;/div&gt;<br>      &lt;div class="modal-footer"&gt;<br>        &lt;button type="button" class="btn btn-secondary" data-dismiss="modal"&gt;Close&lt;/button&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;<br>&lt;!-- model close --&gt;<br><br>    &lt;!-- Optional JavaScript --&gt;<br>    &lt;!-- jQuery first, then Popper.js, then Bootstrap JS --&gt;<br>    &lt;script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"&gt;&lt;/script&gt;<br>    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"&gt;&lt;/script&gt;<br>    &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"&gt;&lt;/script&gt;<br><br>    &lt;script&gt;<br>      $(document).ready(function(){<br>          $("#exampleModalCenter").modal('show');<br>      });<br>  &lt;/script&gt;<br><br>  &lt;/body&gt;<br>&lt;/html&gt;</pre>



<p class="wp-block-paragraph" id="5b51">php artisan serve</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><a href="http://127.0.0.1:8000/contact"><strong>http://127.0.0.1:8000/contact</strong></a></p></blockquote>



<p class="wp-block-paragraph" id="fb2a">Now you can see your project is run like this</p>



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



<p class="wp-block-paragraph" id="e6f7">Now you can see your data has bee saved in database</p>



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



<p class="wp-block-paragraph" id="fac2">Hope this code will work 100% successfully for you <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64f.png" alt="🙏" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64f.png" alt="🙏" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/create-contact-form-in-laravel-5-8/">Create contact form in laravel 5.8</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/create-contact-form-in-laravel-5-8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
