100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary Web, Mobile & Security (Laravel)

Rating
-
Sold
-
Pages
17
Uploaded on
15-01-2022
Written in
2020/2021

Summary of all stuff you need to know for the exam. Including code. With this file you should be able to make the exam.

Institution
Course










Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
January 15, 2022
Number of pages
17
Written in
2020/2021
Type
Summary

Subjects

Content preview

web cheatsheet.md 1/15/2022




Cheatcheat web
Table of content
Including files
Routes
Controller
Yield
Routes & Yield
Databases
Models
Forms
Cookies
Sessions
API (JS)



including files
add css file to blade:


<link href="{{ asset('css/reset.css') }}" rel="stylesheet">
<link href="{{ asset('css/screen.css') }}" rel="stylesheet">



add script to blade (in body bottom)


<script src="{{ asset('js/script.js') }}"></script>



String concatenation:



<img src="{{ asset('media/' . $product -> id . '.png') }}" alt="image of product">




Routes
Routes(web.php) normal:






,web cheatsheet.md 1/15/2022




Route::get('/', function () {
return view('master');
});



Routes(web.php) through controller:


Route::get('/', [BookingController::class, "index"]);

Route::post('/summary', [ControllerName::class, "displaySummary"])
-> name("summary");



include "use \App\Http\Controllers\ControllerName;" at top of web.php

Route function

in blade:



@foreach($products as $product)
<li><a href="{{ route('details', $product -> id ) }}">{{ $product -> name }}
</a></li>
@endforeach



in web.php



Route::get('/products/101', [StoreController::class, "displayIphone"])
->name('101');




Controller
make a new controller:

go to project directory
php artisan make:controller MyController

simple route in controller:






, web cheatsheet.md 1/15/2022




function index() {
return view("master");
}




Yield
ex in master blade:


@yield("view-content")



ex in other blade file:


@extends("master")

@section("view-content")
<h2>Product catalog</h2>
<ul>
<li><a href="#">Apple Iphone 12</a></li>
<li><a href="#">Samsung S21</a></li>
<li><a href="#">LG OLED TV</a></li>
</ul>
@endsection



So now just simply choose which blade you want to use (not the master blade)



Routes & Yield
Make a url that leads to another page:


<li><a href="{{ url('iphone') }}">Apple Iphone 12</a></li>



in web.php it will look like


Route::get('/iphone', [StoreController::class, "displayIphone"]);
$10.07
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
fredericgoossens

Get to know the seller

Seller avatar
fredericgoossens Hogeschool West-Vlaanderen
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
3 year
Number of followers
0
Documents
3
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions