Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
Browse files Browse the repository at this point in the history
  • Loading branch information
JhumanJ committed Nov 7, 2023
2 parents 00e98f6 + 8de1c94 commit 5fb6344
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 789 deletions.
18 changes: 12 additions & 6 deletions app/Http/Controllers/TemplateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function index(Request $request)
{
$limit = null;
if ($request->offsetExists('limit') && $request->get('limit') > 0) {
$limit = (int) $request->get('limit');
$limit = (int)$request->get('limit');
}

$onlyMy = false;
Expand All @@ -24,12 +24,18 @@ public function index(Request $request)
}

$templates = Template::limit($limit)
->when(Auth::check() && !$onlyMy, function ($query) {
$query->where('publicly_listed', true);
$query->orWhere('creator_id', Auth::id());
->when(Auth::check(), function ($query) use ($onlyMy) {
if ($onlyMy) {
$query->where('creator_id', Auth::id());
} else {
$query->where(function ($query) {
$query->where('publicly_listed', true)
->orWhere('creator_id', Auth::id());
});
}
})
->when(Auth::check() && $onlyMy, function ($query) {
$query->where('creator_id', Auth::id());
->when(!Auth::check(), function ($query) {
return $query->publiclyListed();
})
->orderByDesc('created_at')
->get();
Expand Down
204 changes: 0 additions & 204 deletions resources/js/components/open/forms/fields/FormBlockOptionsModal.vue

This file was deleted.

Loading

0 comments on commit 5fb6344

Please sign in to comment.