how to check data security in db insert laravel code example

Example 1: Writing into the database with one click laravel

<form action="{{ route('signup') }}" method="post">
    <button type="submit"> submit </button>
</form>

Example 2: Writing into the database with one click laravel

public function manuelSignUP()
{
DB :: table("users") -> insertGetId
(
array("firstname" => "John", "lastname"=> "John",
"passwordHash" => "password", "userslevelID" => 2)
);

DB :: table("userlevel") -> insertGetID
  (

array("userlevelID" => $userlevelID, "name" => $name)
 );

 return view("pages.manualsignup");
 }

Tags:

Sql Example