api code global jain
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Api\Access\MotherTongue;
|
||||
|
||||
interface MotherTongueInterface
|
||||
{
|
||||
public function getMotherTongueList();
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Api\Access\MotherTongue;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use App\Models\MotherTongue;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Repositories\Api\Access\MotherTongue\MotherTongueInterface;
|
||||
|
||||
class MotherTongueRepository implements MotherTongueInterface
|
||||
{
|
||||
/**
|
||||
* @var MotherTongue
|
||||
*/
|
||||
protected $motherTongue;
|
||||
|
||||
/**
|
||||
* @param MotherTongue $motherTongue
|
||||
* MotherTongueRepository constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(MotherTongue $motherTongue)
|
||||
{
|
||||
$this->motherTongue = $motherTongue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMotherTongueList()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$user = loggedInUser();
|
||||
$data = $this->motherTongue->get()->toArray();
|
||||
|
||||
if ($user && $data) {
|
||||
$response['data'] = $data;
|
||||
$response['status'] = Constant::CODE_200;
|
||||
} else {
|
||||
$response['data'] = [];
|
||||
$response['status'] = Constant::CODE_401;
|
||||
}
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$response['message'] = trans('auth.something_went_wrong');
|
||||
$response['status'] = Constant::CODE_403;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user