###### tags: `php` `laravel`
> [TOC]
# Project (專案開發)
## [Laravel Web 2.0 2/3 (listings part)](/rWHKnbVZQoeCVj4ZLLaK7Q)
## [Laravel Web 2.0 1/3 (User part)](/TcfzknUtSE6wzvbWgpwyFQ)
---
Technical Document
Environment
Mac: Laravel valet
Windows: XAMPP
homestead
without requiring you to install PHP, a web server, and any other server software on your local machine
[Vagrant](https://www.vagrantup.com/)
Virtual machine that manages your machine
---
# Mailing
## Mail driver
Put in the config/mail.php
view/email
```php=
@component('mail::message')
# Wellcome to Meowhecker Mailing center
meowmeowmeowmewo
@component('mail::button', ['url' => 'https::///www.google.com'])
Visit website
@endcomponent
Thanks,<br>
{{ config('app.name') }} <!-- App.name is inside to env file -->
@endcomponent
```
## Configure SMTP
- Mail provider
### Mailtrap
.env file
Instead with Default settings

```
#mail provider (mailtrap
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=************
MAIL_PASSWORD=************
MAIL_ENCRYPTION=tls
```
After setting completely, we have to break off server and restart the server. (run it again
### Set router
```php=
Route::get('/mail', function(){
Mail::to('aa098933967903@gmial.com.tw')->send(new meowhecker());
return new meowhecker;
});
```
Result

- Local development
## Commend
Display the help message
```bash=
php artisan help make:mail
```
Create mail class
```bash=
php artisan make:mail (class of name)
```
put in app/mail
Create mill class using Makdown to write
```bash=
php artisan make:mail meowhecker -m email.emailPage
```
The Email blade outputs to views/emails ....
> [time=Tue, Aug 30, 2022 4:53 PM]
# Authentication and Mailing
Reference [Video](https://www.youtube.com/watch?v=4L79-JJxVjM)
## Gate
It control who has permission could give a action
Before we dive into the gate, we have add column into our table users .
Check if it is a admin or not.
> [time=Tue, Aug 30, 2022 6:04 PM]
app/providers/authServiceProvider
### Start
```bash=
php artisan migrate
php artisan make:migration add_isadmin_to_user --table="users"
php artisan migrate
```
#### Add column to table users
```php=
public function up()
{
Schema::table('users', function (Blueprint $table) {
//add mew column to table "users", and save it into booling
$table->boolean('isAdmin')->default(0);
});
}
```
Update table
```bash=
```
## Odd Problems solve
### Method
I think the problem come from cache

#### Solve way
Add @method('POST') in the form