将数据添加到不在laravel中工作的数据库中

I am using laravel 5.3 I have created a view to create posts and am trying to add data to the table with save method but it is giving me SQL error.

SQL Error: QueryException in Connection.php line 770: SQLSTATE[HY000] [2002] No such file or directory (SQL: insert into posts (title, body, updated_at, created_at) values (Test, sdfhgfj, 2017-02-06 07:43:54, 2017-02-06 07:43:54))

view/posts.create.blade.php:

<div class="row">
  <div class="col-md-8 offset-2">
     <h1>Create New Post</h1>
      <hr>
        {!! Form::open(['route' => 'posts.store']) !!}
          <div class="form-group">
            {{ Form::label('title', 'Title:', ['class' => 'control-label']) }}
            {{ Form::text('title', null, ['class' => 'form-control']) }}
            {{ Form::label('body', 'Body:', ['class' => 'control-label']) }}
            {{ Form::textarea('body', null, ['class' => 'form-control']) }}
          </div>
        {{Form::submit('Create',array('class'=>'form-submit btn btn-success btn-block btn-lg'))}}
        {!! Form::close() !!}
   </div>
</div>

web.php(route file):

Route::resource('posts','PostController');

app/http/Post.php(Model):

namespace App;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    //
}

PostController.php

public function store(Request $request)
{
  //validate
  $this->validate($request,array(
    'title'=>'required|max:255',
    'body'=>'required'
  ));

  //Store 
  $post = new Post;
  $post->title = $request->title;
  $post->body = $request->body;
  $post->save();

  //redirect
  return redirect()->route('posts.show', $post->id);
}

I have also added use App/Post, in top after namespaces in PostController.php but code does not runs after save method. Also, php artisan migrate command runs successfully and tables are created in database, but still facing issue with save.

I have changed host from "localhost" to "127.0.0.1" in .env as well as config/database.php and then restarted server and server now runs on "http://127.0.0.1:8000" instead of "http://localhost:8000"

And it works well!!!