Skip to content

Latest commit

 

History

History
61 lines (45 loc) · 1.26 KB

view.md

File metadata and controls

61 lines (45 loc) · 1.26 KB

View

All views are stored in the views directory. For create the new view file don't forget to add .blade.php after the name of file. For example register.blade.php. Because FYLite using Blade as template engine.

Basic Usage

Call view from controller

// SomeController.php

public function hello()
{
    return view('welcome'); // welcome.blade.php
}

Passing data from controller to view

public function hello()
{
    $name = 'Biobii';
    $age = 20;

    return view('welcome', ['name' => $name, 'age' => $age]);
}

Displaying data

// welcome.blade.php

<p>My name is {{ $name }}</p>
<p>I'm {{ $age }} years old</p>   

Load assets and go to specific URL

FYLite has a helper that makes it easy to call asset files in public folder.

// load assets
<head>
    <title>FYLite</title>
    <link rel="stylesheet" href="{{ asset('css/style.css') }}">
</head>

// go to specific URL
<form action="{{ myurl('login') }}" method="POST">
	{!! csrf_token() !!}
  	// 
</form>

Blade Documentation

Original Blade Documentation

Related Documentation

Back to Home