Professional Documents
Culture Documents
Lab 4
Lab 4
Lab 4
md 2/26/2023
use Illuminate\Support\Facades\Route;
Route::get('/',function(){
return view ('welcome');
});
Route::get('/contacts', function () {
return view('contacts.index');
})->name('contacts.index');
Route::get('/contacts/create', function () {
return view('contacts.create');
})->name('contacts.create');
?>
resources\views\welcome.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>Royal University of Phnom Penh</h1>
1/2
lab4.md 2/26/2023
<h1>Class: M1</h1>
<h1>Name: Dara</h1>
<h1>Contact App</h1>
<div>
<a href='{{ route('contacts.index') }}'>All contacts</a>
</div>
</body>
</html>
resources/views/contacts/index.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>All contacts</h1>
<div>
<a href='{{ route('contacts.create') }}'>Add contact</a>
<a href='{{ route('contacts.show', 1) }}'>Show contact</a>
</div>
</body>
</html>
resources/views/contacts/create.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>Add new contact</h1>
<div>
<a href='{{ route('contacts.index') }}'>Back to all contacts</a>
</div>
</body>
</html>
2/2