M1n1 Shira0ka File Manager
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Subscription extends Model
{
protected $fillable = ['date_start', 'date_end', 'member_id', 'cost', 'credit'];
public function member(){
return $this->belongsTo('App\Member');
}
public function get_date_start() {
$date_start = date($this->date_start);
return date('d-m-Y',strtotime($date_start));
}
public function get_date_end() {
$date_end = date($this->date_end);
return date('d-m-Y',strtotime($date_end));
}
public function get_date_start_slash() {
$date_start = date($this->date_start);
return date('d/m/Y',strtotime($date_start));
}
public function get_date_end_slash() {
$date_end = date($this->date_end);
return date('d/m/Y',strtotime($date_end));
}
public function is_good() {
if ($this->date_end >= date('Y-m-d') ){
if ($this->credit > 0) {
return 2;
}
return 1;
}
return 0;
}
}
GO Party By You