Birmingham mumbai


Download 1.3 Mb.
Pdf ko'rish
bet59/68
Sana05.01.2022
Hajmi1.3 Mb.
#227543
1   ...   55   56   57   58   59   60   61   62   ...   68
Bog'liq
Laravel 5 Essentials

About this site

There are over cats on this site!

Then, return the view using the 

view()


 helper function with the variable,  

$number_of_cats

:

Route::get('about', function() {



  return view('about')->with('number_of_cats', 9000);

});


Finally, visit 

/about


 in your browser to see the rendered view. This view was written 

with plain PHP; however, Laravel comes with a powerful template language called 

Blade, which will be introduced later in this chapter.

Preparing the database

Before we can expand the functionality of our routes, we need to define the models 

of our application, prepare the necessary database schema, and populate the 

database with some initial data.

Homestead ships with a MySQL server built in, so we can use MySQL for our 

database; however, it does require a little bit of configuration first, before we can use 

a MySQL database in our application.

The first step is to open our application's configuration file, which should have been 

created at 

.env


 when we created the application with Composer. Find the line that 

says 


DB_DATABASE=homestead

 and change it to 

DB_DATABASE=furbook

.



Chapter 3


Download 1.3 Mb.

Do'stlaringiz bilan baham:
1   ...   55   56   57   58   59   60   61   62   ...   68




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling