Table of Contents:
- LARAVEL – OVERVIEW……………………………………………………………………………… 1
Introduction………………………………………………………………………………………………. 1
Laravel – Features……………………………………………………………………………………….. 1
- LARAVEL – INSTALLATION…………………………………………………………………………. 2
- LARAVEL – APPLICATION STRUCTURE…………………………………………………………. 4
Root Directory……………………………………………………………………………………………. 4
App Directory…………………………………………………………………………………………….. 5
- LARAVEL – CONFIGURATION…………………………………………………………………….. 6
Basic Configuration……………………………………………………………………………………… 6
Environmental Configuration………………………………………………………………………….. 6
Database Configuration………………………………………………………………………………… 7
Naming the Application…………………………………………………………………………………. 8
Maintenance Mode……………………………………………………………………………………… 8
- LARAVEL – ROUTING………………………………………………………………………………. 10
Basic Routing……………………………………………………………………………………………. 10
Routing Parameters……………………………………………………………………………………. 13
- LARAVEL — MIDDLEWARE………………………………………………………………………. 16
Define Middleware…………………………………………………………………………………….. 16
Register Middleware…………………………………………………………………………………… 17
Middleware Parameters………………………………………………………………………………. 19
Terminable Middleware………………………………………………………………………………. 22
- LARAVEL – CONTROLLERS……………………………………………………………………….. 27
Basic Controllers……………………………………………………………………………………….. 27
Controller Middleware………………………………………………………………………………… 28
Restful Resource Controllers…………………………………………………………………………. 33
Implicit Controllers…………………………………………………………………………………….. 35
Constructor Injection………………………………………………………………………………….. 38
Method Injection………………………………………………………………………………………. 39
- LARAVEL — REQUEST…………………………………………………………………………….. 41
Retrieving the Request URI…………………………………………………………………………… 41
Retrieving Input………………………………………………………………………………………… 43
- LARAVEL – COOKIE…………………………………………………………………………………. 47
Creating Cookie…………………………………………………………………………………………. 47
Retrieving Cookie………………………………………………………………………………………. 47
- LARAVEL — RESPONSE……………………………………………………………………………. 51
Basic Response…………………………………………………………………………………………. 51
Attaching Headers……………………………………………………………………………………… 51
Attaching Cookies………………………………………………………………………………………. 52
JSON Response…………………………………………………………………………………………. 53
- LARAVEL — VIEWS…………………………………………………………………………………. 54
Understanding Views………………………………………………………………………………….. 54
Passing Data to Views…………………………………………………………………………………. 55
Sharing Data with all Views…………………………………………………………………………… 55
Blade Templates……………………………………………………………………………………….. 57
- LARAVEL — REDIRECTIONS……………………………………………………………………… 61
Redirecting to Named Routes………………………………………………………………………… 61
Redirecting to Controller Actions……………………………………………………………………. 62
- LARAVEL — WORKING WITH DATABASE…………………………………………………… 64
Connecting to Database………………………………………………………………………………. 64
Insert Records…………………………………………………………………………………………… 64
Retrieve Records……………………………………………………………………………………….. 67
Update Records………………………………………………………………………………………… 70
Delete Records…………………………………………………………………………………………. 74
- LARAVEL — ERRORS AND LOGGING…………………………………………………………. 78
Errors…………………………………………………………………………………………………….. 78
Logging…………………………………………………………………………………………………… 78
- LARAVEL – FORMS…………………………………………………………………………………. 79
- LARAVEL – LOCALIZATION………………………………………………………………………. 85
- LARAVEL — SESSION………………………………………………………………………………. 89
Accessing Session Data………………………………………………………………………………… 89
Storing Session Data…………………………………………………………………………………… 89
Deleting Session Data…………………………………………………………………………………. 89
- LARAVEL – VALIDATION………………………………………………………………………….. 93
- LARAVEL – FILE UPLOADING……………………………………………………………………. 98
- LARAVEL – SENDING EMAIL…………………………………………………………………… 102
- LARAVEL – AJAX…………………………………………………………………………………… 108
- LARAVEL – ERROR HANDLING………………………………………………………………… 111
HTTP Exceptions………………………………………………………………………………………. 111
Custom Error pages…………………………………………………………………………………… 111
- LARAVEL – EVENT HANDLING………………………………………………………………… 114
- LARAVEL – FACADES…………………………………………………………………………….. 122
- LARAVEL – SECURITY…………………………………………………………………………….. 128