ClientProgram.php 572 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Models;
  3. # use Illuminate\Database\Eloquent\Model;
  4. class ClientProgram extends Model
  5. {
  6. protected $table = "client_program";
  7. public function mcp() {
  8. return $this->hasOne(Pro::class, 'id', 'mcp_pro_id');
  9. }
  10. public function manager() {
  11. return $this->hasOne(Pro::class, 'id', 'manager_pro_id');
  12. }
  13. public function getProgramMonth($m, $y)
  14. {
  15. return ClientProgramMonth::where('client_program_id', $this->id)
  16. ->where('month', $m)
  17. ->where('year', $y)
  18. ->first();
  19. }
  20. }