Commit cc0f7375 authored by Nicolas Widart's avatar Nicolas Widart

Merge pull request #2 from nWidart-Modules/feature/CoreRepositories

Feature/core repositories
parents 5c122607 41c9bbcf
{
"sEmptyTable": "No data available in table",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
"sInfoPostFix": "",
"sInfoThousands": ",",
"sLengthMenu": "Show _MENU_ entries",
"sLoadingRecords": "Loading...",
"sProcessing": "Processing...",
"sSearch": "Search:",
"sZeroRecords": "No matching records found",
"oPaginate": {
"sFirst": "First",
"sLast": "Last",
"sNext": "Next",
"sPrevious": "Previous"
},
"oAria": {
"sSortAscending": ": activate to sort column ascending",
"sSortDescending": ": activate to sort column descending"
}
}
\ No newline at end of file
{
"sProcessing": "Traitement en cours...",
"sSearch": "Rechercher :",
"sLengthMenu": "Afficher _MENU_ éléments",
"sInfo": "Affichage de l'élement _START_ à _END_ sur _TOTAL_ éléments",
"sInfoEmpty": "Affichage de l'élement 0 à 0 sur 0 éléments",
"sInfoFiltered": "(filtré de _MAX_ éléments au total)",
"sInfoPostFix": "",
"sLoadingRecords": "Chargement en cours...",
"sZeroRecords": "Aucun élément à afficher",
"sEmptyTable": "Aucune donnée disponible dans le tableau",
"oPaginate": {
"sFirst": "Premier",
"sPrevious": "Précédent",
"sNext": "Suivant",
"sLast": "Dernier"
},
"oAria": {
"sSortAscending": ": activer pour trier la colonne par ordre croissant",
"sSortDescending": ": activer pour trier la colonne par ordre décroissant"
}
}
\ No newline at end of file
<?php namespace Modules\Core\Repositories;
/**
* Interface CoreRepository
* @package Modules\Core\Repositories
*/
interface BaseRepository
{
/**
* @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);
}
<?php namespace Modules\Core\Repositories\Eloquent;
use Illuminate\Database\Eloquent\Model;
use Modules\Core\Repositories\BaseRepository;
/**
* Class EloquentCoreRepository
* @package Modules\Core\Repositories\Eloquent
*/
abstract class EloquentBaseRepository implements BaseRepository
{
/**
* @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);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment