Laravel Flashcards

1
Q

What is Laravel?

A

Laravel is a free, open source PHP web application framework, designed for the development of model-view-controller web applications.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does MVC stand for?

A

Model-View-Controller

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is homestead?

A

An official, pre-packaged Vagrant “box” that provides you a wonderful development environment without requiring you to install php, hhvm, a web server, ad any other server software on your local machine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a model-view-controller?

A

A software architectural pattern for implementing user interfaces. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to, or accepted from the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the MODEL part of MVC

A

Captures the behaviour of the application in terms of its problem domain, independent of the user interface. The model directly manages the data, logic and rules of the application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe the VIEW part of MVC.

A

It can be any output representation of information, such as a chart or a diagram.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Describe the CONTROLLER part of the MVC

A

Accepts input and converts it to commands for the model or view.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does Laravel Elixir do?

A

Provides a clean, fluent API for defining basic GUlp tasks for your laravel application.

Elixir supports several common CSS and JavaScript pre-processors, and even testing tools.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Gulp?

A

A task-runner which uses Node.js

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does Gulp focus on?

A

Using streams

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do streams work?

A

In Node, the build in stream module is used by the core libraries and can also be used by user-space modules.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Describe the Blade templating system.

A

Blade is a simple, yet powerful templating engine provided with Laravel. Unlike controller layouts, Blade is driven by template inheritance and sections. All Blade templates should use the .blade.php extension.

@section(‘content’)
This is my body content
@stop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do we echo using the Blade templating system

A

by putting content to be echoed in double curly braces:

{{ $name or ‘Default’ }}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the laravel Eloquent Data Model?

A

The Eloquent ORM included with Laravel provides a beautiful, simple ActiveRecord implementation for working with your database. Each database table has a corresponding “Model” which is used to interact with that table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How does Eloquent create a primary key for database tables?

A

Eloquent will also assume that each table has a primary key column named id. You may define a primaryKey property to override this convention.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

how do we create a new laravel project?

A

composer create-project laravel/laravel folderName

17
Q

how do we create a new laravel project?

A

composer create-project laravel/laravel folderName

18
Q

what file do we need to add to in order to see a website that we are creating on our virtual machine?

A

We need to add our domain name to the hosts file (awesome.dev) in order to be able to view the project in our browser

19
Q

What does the routes.php file do?

A

The routes file contains instructions for what to do when a user tries to “get” a certain file on the site.

ex: Route::get(‘/’, ‘WelcomeController@index’);

This example says “when the user tries to “get” the root (/) of the website, find the WelcomeController page and call the function @index

20
Q

What does the routes.php file do?

A

The routes file contains instructions for what to do when a user tries to “get” a certain file on the site.

ex: Route::get(‘/’, ‘WelcomeController@index’);

This example says “when the user tries to “get” the root (/) of the website, find the WelcomeController page and call the function @index

21
Q

Where are the files stored that we actually see in our browser?

A

In views/pages . These files are called by functions in the controllers which return views by name.

22
Q

Where are the files stored that we actually see in our browser?

A

In views/pages . These files are called by functions in the controllers which return views by name.

23
Q

How to we turn on error notifications for development?

A

in the .env directory we change the APP_ENV value from production to LOCAL

24
Q

What is the difference between printing escaped vs non-escaped data in a laravel view

A

escaped data such as {{ data}} will print a literal string (like single quotes in straight php, non-escaped data such as {{!! $data !!}} will parse whatever code/variables are inside the brackets. Use non-escaped data with caution to avoid injection attacks

25
Q

What is the difference between printing escaped vs non-escaped data in a laravel view

A

escaped data such as {{ data}} will print a literal string (like single quotes in straight php, non-escaped data such as {{!! $data !!}} will parse whatever code/variables are inside the brackets. Use non-escaped data with caution to avoid injection attacks

26
Q

What is the difference between printing escaped vs non-escaped data in a laravel view

A

escaped data such as {{ data}} will print a literal string (like single quotes in straight php, non-escaped data such as {{!! $data !!}} will parse whatever code/variables are inside the brackets. Use non-escaped data with caution to avoid injection attacks

27
Q

what is one of the benefits of using the blade system?

A

reduces redundancy of code. rather than having several files for several web pages, we can have one master page that only contains the content we are looking for by using @yield(‘content’) and then having each of our different “pages” use @extends the master page with @section(‘content’)

28
Q

what is one of the benefits of using the blade system (in reference to master pages)?

A

reduces redundancy of code. rather than having several files for several web pages, we can have one master page that only contains the content we are looking for by using @yield(‘content’) and then having each of our different “pages” use @extends the master page with @section(‘content’)

29
Q

how do we use conditionals in laravel?

A

@if (some code) @endif

30
Q

how do we configure our database in laravel?

A

we use the file database.php which is located in the config directory. We reference the passwords and hostnames stored in our .env file to keep things secure (.env is ignored by git and will not be uploaded if you try and push this iteration).

31
Q

how do we configure our database in laravel?

A

we use the file database.php which is located in the config directory. We reference the passwords and hostnames stored in our .env file to keep things secure (.env is ignored by git and will not be uploaded if you try and push this iteration).

32
Q

what is the main advantage of database migrations (laravel)?

A

version control. allows multiple people to work and update the same database and tables.

33
Q

how do we create a new table using migration?

A

-create a new class that extends migration
-create two functions, up and down
-in the up function, create a schema
Schema::create(‘tablename’, function(Blueprint $table){
….table headings….
}
-in the function down, Schema::drop(‘tablename’)
-in the command line use “php artisan migrate” , tables are now created

34
Q

how do you update tables using migration?

A

first, run php artisan migrate:rollback to undo table creation.
second, update your tables and then use the command php artisan migrate

35
Q

how do you update tables using migration?

A

first, run php artisan migrate:rollback to undo table creation.
second, update your tables and then use the command php artisan migrate

36
Q

how can we use the eloquent model to protect our database from injection?

A

by adding a protected array in our database model that indicates which fields can be filled by inputted data