Vagrant是一個方便控管VirtualBox的工具,所以你在說的應該是Homestead的版本才對,Homestead是Laravel封裝的一個包,可以透過Vagrant來自動幫你建立環境
如果你已經更新版本了,要先刪除原有的box
vagrant box remove laravel/homestead
然後可以使用以下指令指定安裝版本
vagrant box add laravel/homestead --box-version 0.2.7
@TonyWang
是啊,但是衝突情況沒有那麼嚴重,如果真要硬用是不會有太多麻煩XD
或是可以不要引入整個包,可以引入需要的單個組件來用
舉例SemanticUI
https://github.com/Semantic-Org/Semantic-UI/tree/master/dist/components
實現這個代表dispatch後會放入Queue(根據你config/queue.php裡面的設定,例如redis)裡面等待排序執行,也就是異步(Async)
執行
下面是框架源碼:
/**
* Dispatch a command to its appropriate handler.
*
* @param mixed $command
* @return mixed
*/
public function dispatch($command)
{
if ($this->queueResolver && $this->commandShouldBeQueued($command)) {
return $this->dispatchToQueue($command);
} else {
return $this->dispatchNow($command);
}
}
/**
* Dispatch a command to its appropriate handler in the current process.
*
* @param mixed $command
* @return mixed
*/
public function dispatchNow($command)
{
return $this->pipeline->send($command)->through($this->pipes)->then(function ($command) {
return $this->container->call([$command, 'handle']);
});
}
/**
* Determine if the given command should be queued.
*
* @param mixed $command
* @return bool
*/
protected function commandShouldBeQueued($command)
{
return $command instanceof ShouldQueue;
}
可以很明顯看他會檢查是否有實現ShouldQueue
有 -> 丟入Queue中
沒有 -> 直接 call handle方法
至於為什麼會返回0,似乎是你queue沒設定,導致他push進去queue時失敗,所以返回個0
多多少少還是會有一些衝突,尤其是semantic ui為了自然語意,ClassName切得頗零碎,但是注意些還是可以使用的很愉快的(衝突就自己寫個css修正吧)
不過如果也有引用js的話,兩者的Modal會衝突,還好有大神提供解決辦法
https://gist.github.com/rafael-neri/27facc327a3320e7591e
@leec
1.建議先在原本你寫的代碼中debug找找return 0的原因
例如把return array_merge....
改成return 'hi im return value'
之類的,看看$data會抓到什麼東西,或是直接在PostFormFields裡面dd檢查哪裡出問題
2.看了一下那個教程,應該是5.1版本,在5.1 -> 5.2版本中
所有的Job都預設implements SelfHandling,所以可以不用加上去了
3.不建議controller傳進去,會使PostFormFields高耦合於Controller,而且這樣也會使Controller增加許多多餘的屬性,所以還是建議已取得返回值為目標來下手
composer create-project laravel/laravel your-project-name 5.1
@tlijian1989 是啊,測試過蠻多次,只要該table包含了enum類型欄位,任何修改動作都會造成報錯,具體可以看該issue https://github.com/laravel/framework/issues/1186
包含enum欄位的table也是一樣
@leec
加個參數
php artisan make:controller xxController --resource
可以取得當前的Request來判斷是否符合參數提供之網址,我是習慣另外寫一個Helper,這樣就可以到處重複使用
class HtmlHelper {
public static function set_active($route) {
return (\Request::is($route.'/*') || \Request::is($route)) ? "active" : '';
}
}
這樣我就可以在Blade中,放在需要active的地方
<div class="navigation">
// other item
<a class="item { HtmlHelper::set_active('question') }">問答</a>
// other item
</div>
這樣只要是
http://xxxxxxxx/question
http://xxxxxxxx/question/1
http://xxxxxxxx/question/create
http://xxxxxxxx/question/1/comments/123
之類的都會符合情況而返回 active
實際使用狀況還要根據需求去變更,例如判斷是否為某個group底下,大概思考方向就是這樣