Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Platform
Commits
91743084
Commit
91743084
authored
Oct 08, 2014
by
Abdel Nalbou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added PHPdoc
parent
8402aaaf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
CoreRepository.php
Repositories/CoreRepository.php
+19
-0
EloquentCoreRepository.php
Repositories/Eloquent/EloquentCoreRepository.php
+25
-0
No files found.
Repositories/CoreRepository.php
View file @
91743084
<?php
namespace
Modules\Core\Repositories
;
/**
* Interface CoreRepository
* @package Modules\Core\Repositories
*/
interface
CoreRepository
{
/**
* @param $id
* @return mixed
*/
public
function
find
(
$id
);
/**
* @return mixed
*/
public
function
all
();
/**
* @param $data
* @return mixed
*/
public
function
add
(
$data
);
/**
* @param $ids
* @return mixed
*/
public
function
remove
(
$ids
);
}
Repositories/Eloquent/EloquentCoreRepository.php
View file @
91743084
...
...
@@ -3,30 +3,55 @@
use
Illuminate\Database\Eloquent\Model
;
use
Modules\Core\Repositories\CoreRepository
;
/**
* Class EloquentCoreRepository
* @package Modules\Core\Repositories\Eloquent
*/
abstract
class
EloquentCoreRepository
implements
CoreRepository
{
/**
* @var Model An instance of the Eloquent Model
*/
protected
$model
;
/**
* @param Model $model
*/
public
function
__construct
(
Model
$model
)
{
$this
->
model
=
$model
;
}
/**
* @param int $id
* @return mixed
*/
public
function
find
(
$id
)
{
return
$this
->
model
->
find
(
$id
);
}
/**
* @return mixed
*/
public
function
all
()
{
return
$this
->
model
->
all
();
}
/**
* @param mixed $data
* @return mixed
*/
public
function
add
(
$data
)
{
return
$this
->
model
->
create
(
$data
);
}
/**
* @param int|int[] $ids
* @return mixed
*/
public
function
remove
(
$ids
)
{
return
$this
->
model
->
destroy
(
$ids
);
...
...
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