SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be null (SQL: insert into posts
(title
, body
, updated_at
, created_at
) values (?, ?, 2019-10-14 17:41:00, 2019-10-14 17:41:00))
controller (CRUD) controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\post;
class postcontroller extends Controller
{
public function store(Request $request)
{
$add = new post;
$add->title= $request->input('title');
$add->body= $request->input('body');;
$add->save();
session()->flash('msg','new post added successfully!');
return redirect()->route('posts.show',$add->id);
}
Model (post model)
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class post extends Model
{
protected $fillable = ['title', 'body'];
}
view ->(it just a from using laravelcollective )
input name='title'
) – Raul