Laravel Flashcards
What are route requests?
Route :: get(‘/’, function () {
return view(‘welcome’);
});
Declaring a route that listens for a get request and a get request is just visiting a URL in the browser. The forward slash in the code above means the request is for the Home page. If we wanted to view the about page, we would add the appropriate directory, example ‘/about’
What is blade.php?
Blade is Laravel’s templating engine, a layer on top of php that offers a few useful bells and whistles.
How are routes and views related?
You can visit the routes file, you can declare routes, and that route can return what we refer to as a view. A view is the markup in the template for what the user views.
What is the Components directory?
Any kind of reusable block that could be referenced in multiple places around your application - a task, a menu, a drop down item, a layout file, a card, a message, an avatar etc.
What is a layout file?
A layout is a component. When we create a layout file within the Components directory, it’s a signal to Laravel that it should be treated as a component.
How do you reference a components file such as the layout file?
We always start components with x- to make sure that they are unique and they don’t interfere with existing html tags, and then we reference the name of the component. Write it just like a simple html tag.
<x-layout>
</x-layout>
What is the variable name called slot?
$slot
What are master files?
We’ve created a new component for a layout file. Some refer to these as Master files. The layout file is almost like the structure for your application. head tag, any scripts or stylesheets you need to import, nav, footer. And then the main section will always be unique for each page so we will define the structure and then we will slot in any page specific markup.
How does blade replace variables like slots <?php echo $slot ?> ?
{{ $slot }}
How does blade relate to vanilla php?
Behind the scenes, your blade code is being compiled to vanilla php.
What are these called? {{ }}
A shortcut blade uses to compile it to a php echo.
What is Tailwind CSS?
A CSS utility framework - you can declare classes that refer to specific CSS properties.
What is PHP?
Hypertext Preprocessor. A popular general-purpose scripting language that is especially suited to web development. Fast, flexible and pragmatic. PHP is an open-source, server-side programming language that can be used to create websites, applications, customer relationship management systems and more. It is a widely-used general-purpose language that can be embedded into HTML.
What’s a prop?
A prop is a custom attribute in php
What levels of colors are used in Tailwind?
Level 100 is the lightest, Level 900 is the darkest
What is a URI?
Uniform Resource Identifier - is a sequence of characters that distinguishes one resource from another
What are blade directives?
They start with the @ symbol. Short hand that compile down to vanilla php echo statements or function calls.
What do braces represent in Laravel?
Braces indicate that whatever is wrapped inside is a wildcard - it contains it to pass to the function so we can use it however we want.