Laravel 5.1 Mailer标记为@internal

时间:2015-07-18 21:35:46

标签: php laravel-5 laravel-5.1

你得到一个标记为@ internal'在PHPStorm。我无法修复代码以使消息消失。我正在使用抽象的Mailer.php

<?php

namespace App\Mailers;

use Illuminate\Contracts\Mail\Mailer as Mail;

abstract class Mailer
{
    /**
     * @var Mail
     */
    protected $mail;

    /**
     * @param Mail $mail
     */
    public function __construct(Mail $mail)
    {
        $this->mail = $mail;
    }

    /**
     * @param $to
     * @param $subject
     * @param $from
     * @param $view
     * @param null $data
     */
    public function mailTo($to, $subject, $from, $view, $data = null)
    {
        $this->mail->send($view, $data, function($message) use ($to, $from, $subject)
        {
            $message->to($to->email)->subject($subject)->from($from);
        });
    }
}

然后我的SiteMailer类扩展了抽象的Mailer

<?php

namespace App\Mailers;

class SiteMailer extends Mailer
{

    /**
     * @param array $data
     * @internal param SupportRequest $request
     * @internal param User $user
     */
    public function sendEmailMessageToSupport(array $data)
    {
        $from = env('MAIL_NOREPLY', 'SUPPORT');
        $to = env('MAIL_NOREPLY', 'SUPPORT');
        $subject = 'Activate Your Account';
        $view = 'pages.support';

        $this->mailTo($to, $subject, $from, $view, $data);
    }
}

以下是我在SupportController中使用SiteMailer的方法

<?php

namespace App\Http\Controllers;

use App\Http\Requests;
use App\Mailers\SiteMailer;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\SupportRequest;

class SupportController extends Controller
{
    public function create()
    {
        return view('pages.support');
    }

    public function store(SupportRequest $request, SiteMailer $mail)
    {
        $mail->sendEmailMessageToSupport($request->all());
    }
}

0 个答案:

没有答案