pivot.php 726 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. * @param string $connection
  20. * @return void
  21. */
  22. public function __construct($table, $connection = null)
  23. {
  24. $this->pivot_table = $table;
  25. static::$connection = $connection;
  26. parent::__construct(array(), true);
  27. }
  28. /**
  29. * Get the name of the pivot table.
  30. *
  31. * @return string
  32. */
  33. public function table()
  34. {
  35. return $this->pivot_table;
  36. }
  37. }