Laravel DB 저장법
use DB;
public function store(Request $request)
{
$title = $request->input('title');
DB::insert('insert into tableName (title) VALUES(?)', [$title]);
}
Laravel 쿼리 빌더 문서를 참고하십시오.
use DB;
public function store(Request $request)
{
$title = $request->input('title');
DB::table('tableName')->insert(['title'=>$request->input('title')]);
}
use App\\ModelName;
public function store(Request $request)
{
$title = $request->input('title');
$todo = new ModelName();
$todo->title = $title;
$todo->save();
}