I have problem with my laravel and sqlserver. Recently no problem with php pod because Ive use this sqlserver on my yii2 project and it work well.
try {
    DB::connection()->getPdo();
    if(DB::connection()->getDatabaseName()){
        echo "Yes! Successfully connected to the DB: " . DB::connection()->getDatabaseName();
    }
} catch (\Exception $e) {
    die("Could not connect to the database.  Please check your configuration.");
}
I also have tried db connection and it returned "Yes! Successfully connected to the DB: MyDB".
This is my controller
public function postsignup(Request $request){
        $this->validate($request, [
            'username' =>'required',
            'email' =>'required',
            'password' =>'required',
        ]);
        try{
            $users = new User;
            $users->id = '15';
            $users->username = $request->input('username');
            $users->password_hash = bcrypt($request->input('password'));
            $users->email = $request->input('email');
            $users->save();
            return redirect('/')->with('response','register success');
        }
        catch(\PDOException $e){
            echo $e->getMessage();
        }
    }
my model
 public $timestamps = false;
    protected $fillable = [
        'username', 'email', 'password_hash',
    ];
    protected $hidden = [
        'password', 'remember_token',
    ];
this is my view
@extends('layouts.app')
@section('content')
    <div class="container">
        <div class="row">
            @if(session('response'))
                <div class="col-md-8 alert alert-success">
                    {{session('success')}}
                </div>
            @endif
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="panel-heading">Register</div>
                    <div class="panel-body">
                        <form class="form-horizontal" method="post" action="{{route('account-create-post')}}">
                            {{ csrf_field() }}
                            <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                                <label for="name" class="col-md-4 control-label">Name</label>
                                <div class="col-md-6">
                                    <input id="name" type="text" class="form-control" name="username"
                                           value="{{ old('name') }}" required autofocus>
                                    @if ($errors->has('name'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('name') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>
                            <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                                <label for="email" class="col-md-4 control-label">E-Mail Address</label>
                                <div class="col-md-6">
                                    <input id="email" type="email" class="form-control" name="email"
                                           value="{{ old('email') }}" required>
                                    @if ($errors->has('email'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>
                            <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                                <label for="password" class="col-md-4 control-label">Password</label>
                                <div class="col-md-6">
                                    <input id="password" type="password" class="form-control" name="password" required>
                                    @if ($errors->has('password'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
                                <div class="col-md-6">
                                    <input id="password-confirm" type="password" class="form-control"
                                           name="password_confirmation" required>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-6 col-md-offset-4">
                                    <button type="submit" class="btn btn-primary">
                                        Register
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
myroutes
Route::post('/signup', array(
    'as' => 'account-create-post',
    'uses' => 'UserController@postsignup'
));
Route::get('/signup', array(
    'as' => 'account-create',
    'uses' => 'UserController@getsignup'
));
This code are used to my signup. First, user fill the signup input field then hit register button to save their data to database but I know something wrong with my connection with database because this 500 error not appear if I comment $users->save() . I also have tried to retrive data from database with $users = User::all(); and this 500 error appear. I hope some one ever faced this error and help me to solve this error so I can continue my work. Fyi I already do debug everywhere so I guess my codes are ok.

