小编mar*_*ark的帖子

如何检查 Laravel 中的表单是否已提交?

我想检查是否单击了表单提交按钮,所以我尝试了:

if($request->input('submit')){
    //do something
    }
Run Code Online (Sandbox Code Playgroud)

并尝试过:

$clicked=$request->input('submit');
if(isset($clicked)){
    //do something
    }
Run Code Online (Sandbox Code Playgroud)

并且还尝试过:

if($request->input('submit')!=null){
    //do something
    }
Run Code Online (Sandbox Code Playgroud)

但是当我单击表单中的提交按钮时,if-inside 的执行永远不会发生,那么检查 Laravel 中是否单击提交按钮的正确方法是什么?

laravel

5
推荐指数
1
解决办法
8639
查看次数

laravel 5.6未定义变量:尝试发送电子邮件时的用户

我正在尝试使用laravel 5.6中的Notification类发送电子邮件,我是新手.

我试图传递用户和书籍信息,但每次我得到以下内容:

未定义的变量:user

这是我的successEmail.php:

  <?php

namespace BOOK_DONATION\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class successEmail extends Notification
{
    use Queueable;
    public $user;
    public $book;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($user,$book)
    {
        //
        $this->user=$user;
        $this->book=$book;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     * …
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-5.2

0
推荐指数
2
解决办法
321
查看次数

标签 统计

laravel ×2

laravel-5.2 ×1

php ×1