我想检查是否单击了表单提交按钮,所以我尝试了:
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.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)