pivot.php 1016 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. protected $pivot_table;
  9. /**
  10. * The database connection used for this model.
  11. *
  12. * @var Laravel\Database\Connection
  13. */
  14. protected $pivot_connection;
  15. /**
  16. * Indicates if the model has update and creation timestamps.
  17. *
  18. * @var bool
  19. */
  20. public static $timestamps = true;
  21. /**
  22. * Create a new pivot table instance.
  23. *
  24. * @param string $table
  25. * @param string $connection
  26. * @return void
  27. */
  28. public function __construct($table, $connection = null)
  29. {
  30. $this->pivot_table = $table;
  31. $this->pivot_connection = $connection;
  32. parent::__construct(array(), true);
  33. }
  34. /**
  35. * Get the name of the pivot table.
  36. *
  37. * @return string
  38. */
  39. public function table()
  40. {
  41. return $this->pivot_table;
  42. }
  43. /**
  44. * Get the connection used by the pivot table.
  45. *
  46. * @return string
  47. */
  48. public function connection()
  49. {
  50. return $this->pivot_connection;
  51. }
  52. }