И
Size: a a a
И
s
DC
$sql = $sql->whereHas('limits', function ($query) {Буду благодарен. А то запутался немного(
return $query->with('item.works')->where(function ($q) {
return $q->where('max_works', 0)->orWhere(function($q) {
return $q->where("max_works", ">", function ($q) {
return $q->where('item.works', function ($q) {
return $q->whereNotIn("status", ["verified", "rejected", "refused"])->count();
});
});
});
});
});
AR
AR
public function up()
{
Schema::table('protocol_templates_access_levels', function (Blueprint $table) {
$table->integer("order")->nullable();
});
// DB::table("protocol_templates_access_levels")->select("*")->delete();
$data = [
[
"id" => 1,
"title" => "Пользователь",
"slug" => "onlyUser",
"order" => 1
],
[
"id" => 2,
"title" => "Отделение",
"slug" => "onlyBranch",
"order" => 2
],
[
"id" => 3,
"title" => "Подразделение",
"slug" => "onlyInstitutionBranch",
"order" => 3
],
[
"id" => 4,
"title" => "МО",
"slug" => "onlyInstitution",
"order" => 4
],
[
"id" => 5,
"title" => "Все МО",
"slug" => "Everybody",
"order" => 5
],
];
\DB::table("protocol_templates_access_levels")->upsert($data, "id");
}
AR
AR
И
DC
И
И
DC
DC
AS
DC
H.
ST
H.
H.
ST