Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webprofile-jwg2024
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Siti Aisah
webprofile-jwg2024
Commits
59a11097
Commit
59a11097
authored
Nov 12, 2019
by
Aan Choesni Herlingga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added master repository
parent
1ed56c77
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
app/Repositories/Repository.php
+76
-0
No files found.
app/Repositories/Repository.php
0 → 100644
View file @
59a11097
<?php
namespace
App\Repositories
;
abstract
class
Repository
{
protected
$model
;
abstract
public
function
get
();
/**
* Display specified resource.
*
* @param varchar $with
* @param uuid $id
* @return \Illuminate\Http\Response
*/
public
function
findId
(
$id
=
null
,
$with
=
null
)
{
return
$this
->
model
->
when
(
$with
,
function
(
$query
)
use
(
$with
)
{
return
$query
->
with
(
$with
);
})
->
when
(
$id
,
function
(
$query
)
use
(
$id
)
{
return
$query
->
where
(
'id'
,
$id
);
})
->
first
();
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public
function
store
(
$request
)
{
$request
[
'userid_created'
]
=
auth
()
->
user
()
->
id
;
return
$this
->
model
->
create
(
$request
);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param Model $model
* @return \Illuminate\Http\Response
*/
public
function
update
(
$request
,
$model
)
{
$request
[
'userid_updated'
]
=
auth
()
->
user
()
->
id
;
return
$model
->
update
(
$request
);
}
/**
* Show the specified resource in storage.
*
* @param uuid $id
* @return \Illuminate\Http\Response
*/
public
function
show
(
$id
)
{
return
$this
->
model
->
where
(
'user_id'
,
$id
)
->
first
();
}
/**
* Remove the specified resource from storage.
*
* @param Model $model
* @return \Illuminate\Http\Response
*/
public
function
destroy
(
$model
)
{
return
$model
->
delete
();
}
}
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