Files
Global-Jain/app/Repositories/Api/Access/MotherTongue/MotherTongueRepository.php
2025-11-05 10:37:10 +05:30

56 lines
1.3 KiB
PHP

<?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;
}
}