I'm a web engineer in my first year of work. This article is a memorandum and memorized output about Laravel.
This article will be serialized slowly. There are three reference books, and I am currently studying the second one.
If anyone has started learning Laravel, I would be grateful if you could take a look with them. If you have any suggestions, please do so.
** (I used Ruby / Rails originally, so if there is the same person, I hope it will be helpful ...) **
This time,
--Regarding the directory structure --Import class by name class and use --Request class --Layout creation and inheritance --Additional word memo
I have a note about it.
I have summarized the points that I thought were important in the directory structure that I tend to forget.
"Namespace" is difficult Japanese, but ** where are you? I think it means to show information such as **.
Regarding use
, it is a description required to import another class.
Is it something like Rails require ...?
sample.php
namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
The information sent from the client to the server is the request, and the reverse is the response.
It can be used with use Illuminate \ Http \ controllers;
.
sample.php
use Illminate\Http\Request;
function test(Request $request) {
$request->url();
}
The methods that can be used are here. (official)
When using the blade template, you can use the functions @section and @yield.
The part enclosed by @ section- @ sectionend
is output to @yield
I felt that I could do something similar to vue's components. From the book, this article was helpful.
--Here document
Used when writing long PHP texts. Something like << EOF
.
--Single action controller
If you create a controller with only one action, you can call it with just the controller name without specifying the action from route.
--Of course, you can pass variables to view from the controller like Rails. Can also be named
sample.php
function index(Request $request) {
return view("hello.index", ["msg" => $request->msg]);
}
It can be called with a variable called $ msg. --HTML escape processing {{!! HTML tags written in this are escaped and output as text !!}}
--Regarding dependencies https://qiita.com/harunbu/items/079ea728d2c9cf4f44d5 --About closures https://qiita.com/Yametaro/items/7a4521e23520947cc43e --General https://qiita.com/Masahiro111/items/82677e7cb2d5c1ba8386 --The file can be different, unlike the component (which was there) and section. https://qiita.com/taka_no_okapi/items/19bde6089ac1a22822d2
Next time, I'll start from around the composer ...
Recommended Posts