嗨,我是 Laravel 事件和侦听器的初学者。所以请解释我如何实现这一目标:
目的 :
向用户发送电子邮件。并知道是否发送了电子邮件。
我的理解 :
Laravel 有内置事件 Illuminate\Mail\Events\MessageSent发送电子邮件后触发,我必须编写一个侦听器来侦听该事件。
我做了什么 :
发送电子邮件:
Mail::to($receiverAddress)->send(new SendNewUserPassword($content));
Run Code Online (Sandbox Code Playgroud)
这工作正常。能够成功向用户发送电子邮件。
为了监听 messageSent 事件,我创建了这个监听器:
<?php
namespace App\Listeners;
use Illuminate\Mail\Events\MessageSent;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class LogSentMessage
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param MessageSent $event
* @return void
*/
public function handle(MessageSent $event)
{
return $event->message;
}
}
Run Code Online (Sandbox Code Playgroud)
注册事件:
protected $listen = [
'App\Events\Event' => …Run Code Online (Sandbox Code Playgroud) 我启用了自定义属性:
Vue.use(Vuetify, {
options: {
customProperties: true
}
});
Run Code Online (Sandbox Code Playgroud)
并尝试通过 CSS 变量使用:
<style>
.custom{
color:var(--v-primary-base);
}
</style>
Run Code Online (Sandbox Code Playgroud)
这是vuetify.js我设置主题的文件:
export default new Vuetify({
icons: {
iconfont: 'mdi',
},
theme: {
themes: {
light: {
background: '#FFFFFF',
primary: '#25316A',
secondary: '#b0bec5',
accent: '#25316A',
error: '#E86674',
orange: '#FF7A0D',
golden: '#A68C59',
badge: '#F5528C',
customPrimary: '#085294',
},
dark: {
primary: '#085294',
}
},
},
})
Run Code Online (Sandbox Code Playgroud)
没有任何主题颜色可通过变量访问。我尝试了很多方法,但没有奏效,也没有抛出错误。任何人都可以请帮助我吗?
我有一个混合使用Laravel和Angular路由的问题,同时尝试捕获我的非Laravel路由并呈现Angular视图.
我在app\http\route.php中添加了丢失的方法后出现以下错误:
Facade.php第216行中的FatalErrorException:调用未定义的方法Illuminate\Foundation\Application :: missing()
我知道这对laravel 5或者down版本可以正常工作,但是我目前没有使用laravel 5.2,那么如何在laravel 5.2中编码?有解决方案吗
route.php看起来像:
<?php // app/routes.php
// HOME PAGE ===================================
// I am not using Laravel Blade
// I will return a PHP file that will hold all of our Angular content
Route::get('/', function() {
View::make('index'); // will return app/views/index.php
});
// API ROUTES ==================================
Route::group(['prefix' => 'api'], function() {
// Angular will handle both of those forms
// this ensures that a user can't access api/create or api/edit when there's nothing there …Run Code Online (Sandbox Code Playgroud) laravel ×2
php ×2
angularjs ×1
laravel-5 ×1
laravel-5.2 ×1
laravel-5.5 ×1
sass ×1
vue.js ×1
vuetify.js ×1