Skip to content

Instantly share code, notes, and snippets.

@sanuj
Last active April 26, 2017 07:12
Show Gist options
  • Save sanuj/0bbf15c11c35be686c3c8e5823a8cf09 to your computer and use it in GitHub Desktop.
Save sanuj/0bbf15c11c35be686c3c8e5823a8cf09 to your computer and use it in GitHub Desktop.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class EeShippingStatus extends Model
{
const INITIATED = 1;
const DISPATCHED = 2;
const DELIVERED = 3;
const RETURNED = 4;
const PENDING_RETURN = 5;
public static function getStatusNameAttribute($shipping_id) {
$map = [ null, 'Initiated', 'Dispatched', 'Delivered', 'Returned', 'Pending Return' ];
return $map[$shipping_id] ?? null;
}
}
@znck
Copy link

znck commented Apr 26, 2017

$map = [ null, 'Initiated',  'Dispatched', 'Delivered', 'Returned', 'Pending Return' ];

return $map[$shipping_id] ?? null;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment