我有一个名为“my-new-project”的项目(这只是一个示例)。使用 laragon 自动虚拟主机名功能,我可以通过http://my-new-project.test/浏览该项目
是否可以使用其他名称而不是该项目名称来浏览该项目,例如... http://project.test/?
另外,位于 C:\larragon\etc\apache2\sites-enabled 内的 .conf 文件中的ServerName和ServerAlias是什么?
我将 where 与多个 whereHas() 一起使用,但没有得到预期的结果。
这是我的代码
public function getCommunityScoreByUser($user,$category_id) {
$question_ids = $user->answers->pluck('question_id')->unique();
$specialities = $this->speciality
->whereHas('questions', function($qry) use($question_ids){
$qry->whereIn('questions.id', $question_ids);
})
->orwhereHas('caseStudies', function($qry) use($user) {
$qry->where('user_id', $user->id);
})
->where('is_active', 'Y')
->where('category_id',$category_id)
->withCount('answers')
->withCount(['answers as bestAnswerCount' => function ($query) {
$query->where('question_answer.is_accepted','Y');
}])
->with(['answers' => function ($query) {
$query->withCount(['votes' => function ($query) {
$query->where('count','1');
}]);
}])
->get();
foreach ($specialities as $speciality => $key) {
$votes_count = 0;
foreach ($key->answers as $key1 => $value) {
$votes_count += $value->votes_count;
}
$key->votesCount = $votes_count; …Run Code Online (Sandbox Code Playgroud) 这是我的FormRequest类
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use URL;
class CaseStudyUpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$id = $this->request->get('cspid');
dump($this);
dump($id);
$prev_url = URL::previous();
$url_arr = explode('/', $prev_url);
$data = $this->request->all();
dump($data);
$rules = [
// 'post_title' …Run Code Online (Sandbox Code Playgroud)