ClientInfoLine.php 556 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Models;
  3. # use Illuminate\Database\Eloquent\Model;
  4. class ClientInfoLine extends Model
  5. {
  6. protected $table = 'client_info_line';
  7. public function createdBySession() {
  8. return $this->hasOne(AppSession::class, 'id', 'created_by_session_id');
  9. }
  10. public function contentDetail($prop = null) {
  11. $x = json_decode($this->content_detail);
  12. if(!$prop){
  13. return $x;
  14. }else{
  15. $x = json_decode($this->content_detail, true);
  16. if(isset($x[$prop])){
  17. return $x[$prop];
  18. }else{
  19. return '';
  20. }
  21. }
  22. }
  23. }