Templating Laravel

 Membuat Templating Laravel v4




Membuat templating untuk mempermudah pemrosesan kode program serta membuat tampilan kode menjadi lebih mudah dipahami

Routes (web.php)

use App\Http\Controllers\AuthController as auth;

Route::get('/login' , [auth::class ,'login']);
Route::get('/register', [auth::class, 'register']);
Route::get('/home', [auth::class, 'home']);

Controllers (AuthController.php)

class AuthController extends Controller
{
    public function login(){
        return view('login');
    }
}

View (login.php)

@extends('master')

@section('title', 'login')

@section('content')

<h2>ini adalah halaman Login</h2>
   
@endsection

View (master.php)

<title>Halaman | @yield('title')</title>

     {{-- Headerrr --}}
    @include('Parts/header')

    {{-- Kontent --}}
    @yield('content')

    {{-- Footer --}}
    @include('Parts/footer')

View (Footer.php)

<h1>Footer</h1>


Posting Komentar

Post a Comment (0)

Lebih baru Lebih lama