73 lines
1.9 KiB
PHP
73 lines
1.9 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models\Traits\Certificate\Attributes;
|
||
|
|
|
||
|
|
use App\Constant\Constant;
|
||
|
|
use App\Traits\ActionButtons;
|
||
|
|
|
||
|
|
trait CertificateAttributes
|
||
|
|
{
|
||
|
|
use ActionButtons;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param $value
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getAadharCardFrontPhotoAttribute($value): string
|
||
|
|
{
|
||
|
|
return getImage($value, Constant::USER_CERTIFICATES_UPLOAD_PATH, 'medium');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param $value
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getAadharCardBackPhotoAttribute($value): string
|
||
|
|
{
|
||
|
|
return getImage($value, Constant::USER_CERTIFICATES_UPLOAD_PATH, 'medium');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getCertificateStatusActionAttribute(): string
|
||
|
|
{
|
||
|
|
if ($this->status === 0) {
|
||
|
|
return '<span class="label label-lg label-light-warning label-inline">' . __('label.pending') . '</span>';
|
||
|
|
} elseif ($this->status === 1) {
|
||
|
|
return '<span class="label label-lg label-light-success label-inline">' . __('label.approved') . '</span>';
|
||
|
|
} else {
|
||
|
|
return '<span class="label label-lg label-light-danger label-inline">' . __('label.rejected') . '</span>';
|
||
|
|
}return getImage($value, Constant::USER_CERTIFICATES_UPLOAD_PATH . $auth->id . '/', '');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getCertificateViewButtonAttribute(): string
|
||
|
|
{
|
||
|
|
return $this->viewButton(route('admin.certificates.show',$this->id),'View');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getCertificateActionButtonsAttribute(): string
|
||
|
|
{
|
||
|
|
return $this->certificate_view_button;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param $value
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getPdfUrlAttribute($value): string
|
||
|
|
{
|
||
|
|
if($value) {
|
||
|
|
return getImage($value, Constant::USER_CERTIFICATES_UPLOAD_PATH, '') ?? '';
|
||
|
|
}
|
||
|
|
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
}
|