0%

Laravel学习笔记

Laravel学习笔记

部署环境

(使用docker desktop部署)

Laravel sail?

Laravel Sail uses the docker-compose.yml file and the sail script that is stored at the vendor folder of your project at vendor/bin/sail. The sail script provides a CLI with convenient methods for interacting with the Docker containers defined by the docker-compose.yml file.

Issues

80端口占用?

nginx -s stop```或者修改composer.yml的端口设置(改成"8084:80"), 然后重新run ```./vendor/bin/sail up```。然后8084端口访问。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

yaml.scanner.ScannerError: while scanning for the next token
found character '\t' that cannot start any token?
yml文件中不能有tab, 只能空格。

## Routing
- can return:
- view
- json (useful in building API)

for version 8,

```php
use App\Http\Controllers\UserController;

// Using PHP callable syntax...
Route::get('/users', [UserController::class, 'index']);

// Using string syntax...
Route::get('/users', 'App\Http\Controllers\UserController@index');
  • use controller handling routing

Database Accessing

.env and config/database.php

  • php artisan migrate:fresh will drop all migrations and re-run all…
  • php artisan help make:model //generate multifiles..

Views

Forms

Controller

Eloquent

Authentication

Core Concepts

Mail

Notifications

Events

Authorization

Final Project