Skip to content

Instantly share code, notes, and snippets.

@aryadiahmad4689
Last active December 4, 2020 23:32
Show Gist options
  • Save aryadiahmad4689/770c868b6f85ae1fb794d9fe0c359d55 to your computer and use it in GitHub Desktop.
Save aryadiahmad4689/770c868b6f85ae1fb794d9fe0c359d55 to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Customer;
class CustomerController extends Controller
{
public function index()
{
$customers = Customer::all();
return view('customer.index',compact('customers'));
}
public function create()
{
return view('customer.create');
}
public function store(Request $request)
{
$customer = new Customer;
$customer->name = $request->nama;
$customer->email = $request->email;
$customer->save();
return redirect()->route('customer.index');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment