Created
June 12, 2020 10:42
-
-
Save bosz/d06fd774785a9ac6d196f900c3d7360f to your computer and use it in GitHub Desktop.
Fongoh's class: Learning Laravel with Aiysha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>About aiysha's event</title> | |
</head> | |
<body> | |
<h1>About my events</h1> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>{{ $user['name'] }} | user - Student Events</title> | |
</head> | |
<body> | |
<h1>{{ $user['name'] }}</h1> | |
<p>{{ $user['email'] }}</p> | |
<p>{{ $user['phone'] }}</p> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
class UserController extends Controller | |
{ | |
public function index() | |
{ | |
// Fetch users from database | |
$usersArray = ['Aiysha', 'Martin', 'Base']; | |
return view('users') | |
->with('viewUsers', $usersArray); | |
} | |
public function singleUser($name) | |
{ | |
// Go to db and fetch informationa about $name | |
$user = [ | |
'name' => $name, | |
'email' => '[email protected]', | |
'phone' => '4993934934', | |
]; //example of what's coming from DB | |
return view('single-user') | |
->with('user', $user); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>All users</title> | |
<style type="text/css"> | |
li { | |
line-height: 3; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>All event users</h1> | |
<ul> | |
@foreach($viewUsers as $index => $user) | |
<li> | |
<a href="{{ route('user', ['name' => $user]) }}"> | |
{{ $index }}: {{ $user }} | |
</a> | |
</li> | |
@endforeach | |
</ul> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
|-------------------------------------------------------------------------- | |
| Web Routes | |
|-------------------------------------------------------------------------- | |
| | |
| Here is where you can register web routes for your application. These | |
| routes are loaded by the RouteServiceProvider within a group which | |
| contains the "web" middleware group. Now create something great! | |
| | |
*/ | |
Route::get('/', function () { | |
return view('welcome'); | |
}); // sample route | |
Route::get('/about-us', function() { | |
return view('about-us-view'); | |
})->name('about-us'); | |
Route::get('users', 'UserController@index'); | |
Route::get('user/{name}', 'UserController@singleUser')->name('user'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Laravel</title> | |
<!-- Fonts --> | |
<link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet"> | |
<!-- Styles --> | |
<style> | |
html, body { | |
background-color: #fff; | |
color: #636b6f; | |
font-family: 'Nunito', sans-serif; | |
font-weight: 200; | |
height: 100vh; | |
margin: 0; | |
} | |
.full-height { | |
height: 100vh; | |
} | |
.flex-center { | |
align-items: center; | |
display: flex; | |
justify-content: center; | |
} | |
.position-ref { | |
position: relative; | |
} | |
.top-right { | |
position: absolute; | |
right: 10px; | |
top: 18px; | |
} | |
.content { | |
text-align: center; | |
} | |
.title { | |
font-size: 84px; | |
} | |
.links > a { | |
color: #636b6f; | |
padding: 0 25px; | |
font-size: 13px; | |
font-weight: 600; | |
letter-spacing: .1rem; | |
text-decoration: none; | |
text-transform: uppercase; | |
} | |
.m-b-md { | |
margin-bottom: 30px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="flex-center position-ref full-height"> | |
@if (Route::has('login')) | |
<div class="top-right links"> | |
@auth | |
<a href="{{ url('/home') }}">Home</a> | |
@else | |
<a href="{{ route('login') }}">Login</a> | |
@if (Route::has('register')) | |
<a href="{{ route('register') }}">Register</a> | |
@endif | |
@endauth | |
</div> | |
@endif | |
<div class="content"> | |
<div class="title m-b-md"> | |
Aisyah Events | |
</div> | |
<div class="links"> | |
<a href="{{ route('about-us') }}">About page</a> | |
<a href="/about-us">About simple</a> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment