Laravel 5 Tutorial : Understanding Views in Laravel

Tutorial Laravel 5 for beginners : How to pass data to all views in Laravel 5? How to Understanding Views in Laravel 5?

Laravel 5 Tutorial - Model View Controller in MVC PHP Framework that the 'V' letter mean a Views. In Laravel Php Framework Views are stored under the resources folder resources/views.

Please Read :
  1. Basics Controller in Laravel 5
  2. Basics Routing in Laravel 5
Views will display data and various additional interface elements as needed.

we can pass all data from the database and show to the Views file.

Understanding Views in Laravel

To understand the Views in Laravel, we will create new project that showing a string "Hello World!" to the "helloworld.php" in Views folder.

resources\views\helloworld.blade.php

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Hello World!</title>
  </head>
  <body>
    <h1>Hello World</h1>
  </body>
</html>

After that, we will add new route at the app\Http\routes.php

app\Http\routes.php

Route::get('/hello', 'helloController@index');

The routes file will get route from helloController at the index method, just create 'helloController.php' at app\Http\Controllers. you can create the Controller using 'Artisan' CLI.

app\Http\Controllers\helloController.php

<?php

namespace AppHttpControllers;

use IlluminateHttpRequest;

use AppHttpRequests;

class helloController extends Controller
{
  public function index(){
    return view('helloworld');
  }
}

now, open in your browser by following the url 'http://localhost:8080/hello', the result is "Hello World!"
Understanding Views in Laravel

Understanding Views in Laravel
You can passing data or some arrays data to the views.

in the Views resources/views you can make A blade template contains extension (.blade.php), at the next lessons, we will tech you about templating in Laravel.

COMMENTS

Next Recomended


Feel free to code it up and send us a pull request.

Hi everyone, let's me know how much this lesson can help your work. Please Subscribe and Follow Our Social Media 'kodeajaib[dot]com' to get Latest tutorials and will be send to your email everyday for free!, Just hit a comment if you have confused. Nice to meet you and Happy coding :) all ^^



Follow by E-Mail


Name

ADO.NET,3,Ajax,6,Android,9,AngularJS,4,ASP.NET,4,Blogger Tutorials,7,Bootstrap,7,C++,1,Codeigniter,2,Cplusplus,6,Crystal Report,6,CSharp,25,Ebook Java,2,FlyExam,1,FSharp,3,Game Development,2,Java,35,JDBC,2,Laravel,84,Lumen,2,MariaDB,2,Ms Access,3,MySQL,31,ODBC,6,OleDB,1,PHP,14,PHP Framework,5,PHP MYSQLI,9,PHP OOP,5,Python,8,Python 3,4,SQL Server,4,SQLite,4,Uncategorized,5,Vb 6,2,Vb.Net,89,Video,48,Vue Js,4,WPF,2,Yii,3,
ltr
item
KODE AJAIB: Laravel 5 Tutorial : Understanding Views in Laravel
Laravel 5 Tutorial : Understanding Views in Laravel
Tutorial Laravel 5 for beginners : How to pass data to all views in Laravel 5? How to Understanding Views in Laravel 5?
https://4.bp.blogspot.com/-w7RjYRQXntU/V78OdY9ZftI/AAAAAAAACU0/4lLXnmyuCA0Aizbea2N5lx63SPRiyemIwCLcB/s320/views--basic-laravel5-1.png
https://4.bp.blogspot.com/-w7RjYRQXntU/V78OdY9ZftI/AAAAAAAACU0/4lLXnmyuCA0Aizbea2N5lx63SPRiyemIwCLcB/s72-c/views--basic-laravel5-1.png
KODE AJAIB
https://www.kodeajaib.com/2016/08/laravel-5-tutorial-understanding-views.html
https://www.kodeajaib.com/
https://www.kodeajaib.com/
https://www.kodeajaib.com/2016/08/laravel-5-tutorial-understanding-views.html
true
3214704946184383982
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy