how to directly transfer data from html to controller in laravel code example

Example 1: laravel load view in variable

$html = view('users.edit', compact('user'))->render();

Example 2: return view with variable laravel

return View::make('blog')->with('posts', $posts);

Example 3: how to directly transfer data from html to controller in laravel

public function users(Request $request)
{
    $name = $request->input('firstname'); // This is better than using $_POST
    $lastname = $request->input('lastname');

    DB :: table("newUsers") -> insertGetId
    (
        array("firstname" => $name, "lastname" => $lastname, "email" => "test")
     );

    return view("pages.users");
}

Example 4: how to directly transfer data from html to controller in laravel

$request->input('firstname');

Tags:

Misc Example