Writing into the database with one click laravel code example

Example 1: 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");
 }

Example 2: Writing into the database with one click laravel

<!DOCTYPE html>
 <html>
<head> </head>

<body> This should  </body>
<br><br><br><br>
<form method="post">
<button type="button"> submit </button>
</form>
</html>

Example 3: Writing into the database with one click laravel

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

Example 4: Writing into the database with one click laravel

Route::post('/signup', [
    'as'   => 'signup',
    'uses' => 'YourController@manuelSignUP',
]);

Tags:

Php Example