pivot.php 637 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php namespace Laravel\Database\Eloquent;
  2. class Pivot extends Model {
  3. /**
  4. * The name of the pivot table's table.
  5. *
  6. * @var string
  7. */
  8. public $pivot_table;
  9. /**
  10. * Indicates if the model has update and creation timestamps.
  11. *
  12. * @var bool
  13. */
  14. public static $timestamps = true;
  15. /**
  16. * Create a new pivot table instance.
  17. *
  18. * @param string $table
  19. * @return void
  20. */
  21. public function __construct($table)
  22. {
  23. $this->pivot_table = $table;
  24. parent::__construct(array(), true);
  25. }
  26. /**
  27. * Get the name of the pivot table.
  28. *
  29. * @return string
  30. */
  31. public function table()
  32. {
  33. return $this->pivot_table;
  34. }
  35. }