Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
el3ab-Player
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
el3ab-Player
Commits
a11f4199
Commit
a11f4199
authored
Jun 06, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add upsert method to SupabaseClient for arena seekers
Co-Authored-By:
Claude Opus 4.6
<
noreply@anthropic.com
>
parent
ddc21a8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
database.php
config/database.php
+15
-0
No files found.
config/database.php
View file @
a11f4199
...
@@ -64,6 +64,21 @@ class SupabaseClient {
...
@@ -64,6 +64,21 @@ class SupabaseClient {
return
$this
->
request
(
'DELETE'
,
$url
);
return
$this
->
request
(
'DELETE'
,
$url
);
}
}
public
function
upsert
(
string
$table
,
array
$data
,
string
$onConflict
=
''
)
:
array
{
$url
=
$this
->
baseUrl
.
'/'
.
$table
;
$headers
=
$this
->
headers
();
$headers
=
array_map
(
function
(
$h
)
use
(
$onConflict
)
{
if
(
str_starts_with
(
$h
,
'Prefer:'
))
{
return
'Prefer: return=representation,resolution=merge-duplicates'
;
}
return
$h
;
},
$headers
);
if
(
$onConflict
)
{
$url
.=
'?on_conflict='
.
$onConflict
;
}
return
$this
->
request
(
'POST'
,
$url
,
$data
,
$headers
);
}
public
function
rpc
(
string
$fn
,
array
$data
=
[])
:
array
{
public
function
rpc
(
string
$fn
,
array
$data
=
[])
:
array
{
$url
=
$this
->
baseUrl
.
'/rpc/'
.
$fn
;
$url
=
$this
->
baseUrl
.
'/rpc/'
.
$fn
;
return
$this
->
request
(
'POST'
,
$url
,
$data
);
return
$this
->
request
(
'POST'
,
$url
,
$data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment