I have completed my development in homestead. When I deployed the changes in digitalocean and when i try to submit the records, I am getting the below error and 'query_string' is added in insert/update statements. My application is tested in local development machine (homestead + vagrant) and works fine.
query_string is added in the insert statement. when i monitor my local environment 'query_string' is not added in the insert statement. After deploying into digital ocean, I am getting this error.
i do not know how the query_string is column is added in the insert statement. My controller class is below (it works very well in local homestead)
<?php namespace App\Http\Controllers;
use App\Http\Requests\CountryRequest;
use App\Country;
use Carbon\Carbon;
use Cartalyst\Sentinel\Laravel\Facades\Activation;
use File;
use Hash;
use Illuminate\Http\Request;
use Lang;
use Mail;
use Redirect;
use Sentinel;
use URL;
use View;
use Datatables;
use Validator;
class CountriesController extends Controller
{
public function index()
{
// Show the page
return view('admin.countries.index', compact('countries'));
}
public function data()
{
$countries = Country::get(['id', 'name','created_at']);
return Datatables::of($countries)
->edit_column('created_at',function(Country $country) {
return $country->created_at->diffForHumans();
})
->add_column('actions',function($country) {
$actions = '<a href='. route('admin.countries.edit', $country->id) .'><i class="livicon" data-name="edit" data-size="18" data-loop="true" data-c="#428BCA" data-hc="#428BCA" title="update country"></i></a>';
if($user = Sentinel::getUser())
{
if($user->inRole('admin'))
{
$actions .= '<a href='. route('admin.countries.confirm-delete', $country->id) .' data-toggle="modal" data-target="#delete_confirm"><i class="livicon" data-name="folder-remove" data-size="18" data-loop="true" data-c="#f56954" data-hc="#f56954" title="delete country"></i></a>';
}
}
return $actions;
}
)
->make(true);
}
/**
* Create new country
*
* @return View
*/
public function create()
{
// Show the page
return view('admin.countries.create');
}
/**
* Country create form processing.
*
* @return Redirect
*/
public function store(CountryRequest $request)
{
$country = new Country($request->all());
if ($country->save()) {
return redirect('admin/countries')->with('success', trans('countries/message.success.create'));
} else {
return Redirect::route('admin/countries')->withInput()->with('error', trans('countries/message.error.create'));
}
}
/**
* User update.
*
* @param int $id
* @return View
*/
public function edit(Country $country)
{
return view('admin.countries.edit', compact('country'));
}
/**
* User update form processing page.
*
* @param Country $country
* @param UserRequest $request
* @return Redirect
*/
public function update(Country $country, CountryRequest $request)
{
if ($country->update($request->all())) {
return redirect('admin/countries')->with('success', trans('countries/message.success.update'));
} else {
return Redirect::route('admin/countries')->withInput()->with('error', trans('countries/message.error.update'));
}
}
/**
* Show a list of all the deleted users.
*
* @return View
*/
public function getDeletedCountries()
{
// Grab deleted users
$countries = Country::onlyTrashed()->get();
// Show the page
return view('admin.deleted_countries', compact('countries'));
}
/**
* Delete Confirm
*
* @param Country $country
* @return View
*/
public function getModalDelete(Country $country)
{
$model = 'countries';
$confirm_route = $error = null;
try {
$confirm_route = route('admin.countries.delete', ['id' => $country->id]);
return view('admin.layouts.modal_confirmation', compact('error', 'model', 'confirm_route'));
} catch (GroupNotFoundException $e) {
$error = trans('countries/message.error.delete', compact('id'));
return view('admin.layouts.modal_confirmation', compact('error', 'model', 'confirm_route'));
}
}
/**
* Delete the given Country.
*
* @param Country $country
* @return Redirect
*/
public function destroy(Country $country)
{
if ($country->delete()) {
return redirect('admin/countries')->with('success', trans('countries/message.success.delete'));
} else {
return Redirect::route('admin/countries')->withInput()->with('error', trans('countries/message.error.delete'));
}
}
}
Please help
QueryException in Connection.php line 770:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'query_string' in 'field list' (SQL: insert into countries (name, query_string, updated_at, created_at) values (USA, , 2017-01-09 10:46:59, 2017-01-09 10:46:59))