MVC & Eloquent

0.0(0)
studied byStudied by 5 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/15

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

16 Terms

1
New cards

Model-View-Controller. It is the architectural pattern used by Laravel to separate logic (Controller), data (Model), and display (View).

What does MVC stand for?

2
New cards

It handles the user's request, processes logic, retrieves data (via Models), and passes that data to the View.

Role of the Controller

3
New cards

It is the layer responsible for interacting directly with the database tables.

Role of the Model

4
New cards

app/Http/Controllers

Standard directory for Controllers

5
New cards

Pass an array as the second argument to the view() helper: return view('home', ['categories' => $categories]);

How to pass data from a Controller to a View

6
New cards

Model-View-Controller. It is the architectural pattern used by Laravel to separate logic (Controller), data (Model), and display (View).

What does MVC stand for?

7
New cards

php artisan make:model ModelName

Artisan command to create a Model

8
New cards

Query Builder (using the DB facade).

Eloquent ORM (using Models).

Two main ways to retrieve DB data in Laravel

9
New cards

Route::get('/', [HomeController::class, 'index']); (Uses an array with the Class and the method name).

Route syntax using a Controller

10
New cards

It handles the user's request, processes logic, retrieves data (via Models), and passes that data to the View.

Role of the Controller

11
New cards

$categories = Category::all();

Eloquent syntax to get all categories

12
New cards

app/Models

Standard directory for Models

13
New cards

@foreach($items as $item) ... @endforeach

Blade directive for looping through data

14
New cards

It is the layer responsible for interacting directly with the database tables.

Role of the Model

15
New cards

$categories = DB::table('categories')->get();

Query Builder syntax to get all categories

16
New cards

php artisan make:controller ControllerName

Artisan command to create a Controller