shihherokai

986 经验值

我使用Vue的Element UI在本地透過
Laravel Valet 工作時都可以正常瀏覽Icon
但我把整個檔案推上Ubuntu(Nginx)上
就顯示字體無法加載的console訊息導致Icon無法正確顯示

Failed to decode downloaded font: ...........onts/vendor/element-ui/lib/theme-chalk/element-icons.woff?9b70ee41d12a1cf127400d23534f7efc
OTS parsing error: invalid version tag

感覺問題應該是出在我的Ubuntu(Nginx)上可是不知道怎麼去做調整

後來發現補上
public function handle($response="", $ch="")
就解決了

在執行php artisan queue:work的時候不斷的出現
[2017-09-07 17:52:20] Processing: AppJobsMyJob
以下是MyJob.php的內容

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class MyJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    private $acc_token;
    private $sender;
    private $answer;
    private $file_type;
    private $file_url;
    private $response;
    private $ch;


    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($acc_token, $sender, $answer, $file_type, $file_url)
    {
        $this->acc_token = $acc_token;
        $this->sender = $sender;
        $this->answer = $answer;
        $this->file_type = $file_type;
        $this->file_url = $file_url;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle($response, $ch)
    {
        $response = [
            'recipient' => [ 'id' => $this->sender ],
            'message' => [ 'text' => $this->answer ],
        ];
        $ch = curl_init('https://graph.facebook.com/v2.10/me/messages?access_token='.$this->acc_token);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($response));
        curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
        curl_exec($ch);
        curl_close($ch);
    }
}

剛剛上網搜了一下 http://oomusou.io/laravel/laravel-service/
可以使建立一個 Service 來處理邏輯的部分
不過看了還是不太懂該如何操作

最近看完了大大PHP 物件導向的課程
想請教,如果我要在Controller裡面調用Class
我應該把我的Class寫在哪邊?
或是一般大家在操作的話都是放在哪裡?

我找到問題了,data要傳送到views/mail只要裡面的參數有錯就會出現這個問題,真的要反覆一直檢查,感謝大神回覆

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use App\Models\Website\Feedback;
use Mail;

class SendReminderEmail implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $data;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($dataid)
    {
        $data = Feedback::where('id',$dataid)->first();
        $this->data = $data;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        Mail::send('emails.online_contact', [
                'order_number' => $this->data->order_number,
                'name' => $this->data->name,
                'phone' => $this->data->phone,
                'type' => $this->data->type,
                'email' => $this->data->email,
                'subject' => $this->data->subject,
                'content' => $this->data->content,
                'content' => $this->data->content,
                'business' => $this->data->business,
                'public' => $this->data->public,
                'remark' => $this->data->remark,
            ], function($message){
            $message->to('[email protected]', 'name');
            $message->subject('表單');
        });
    }
}

我看著教學步驟操作,但是我得到的結果不太一樣

當我執行了 php artisan queue:work

我的command不斷重複出現
[2017-08-15 14:11:35] Processing: AppJobsSendReminderEmail
[2017-08-15 14:11:35] Processing: AppJobsSendReminderEmail
[2017-08-15 14:11:35] Processing: AppJobsSendReminderEmail
這樣的訊息

我去察看我的 logs 紀錄
裡面的訊息是
C:xampphtdocsartisan(36): IlluminateFoundationConsoleKernel->handle(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))

請問是碰到了甚麼樣的狀況,能夠排除嗎?

好的,我在嘗試看看,謝謝您