pivot.php 870 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
<?php namespace Laravel\Database\Eloquent;

class Pivot extends Model {

	/**
	 * The name of the pivot table's table.
	 *
	 * @var string
	 */
	public $pivot_table;

	/**
13 14 15 16 17 18 19
	 * Indicates if the model has update and creation timestamps.
	 *
	 * @var bool
	 */
	public static $timestamps = true;

	/**
20 21 22
	 * Create a new pivot table instance.
	 *
	 * @param  string  $table
23
	 * @param  string  $connection
24 25
	 * @return void
	 */
26
	public function __construct($table, $connection = null)
27 28
	{
		$this->pivot_table = $table;
29
		$this->connection = $connection;
30 31 32 33 34 35 36 37 38 39 40 41 42 43

		parent::__construct(array(), true);
	}

	/**
	 * Get the name of the pivot table.
	 *
	 * @return string
	 */
	public function table()
	{
		return $this->pivot_table;
	}

44 45 46 47 48 49 50 51 52 53
	/**
	 * Get the connection used by the pivot table.
	 *
	 * @return string
	 */
	public function connection()
	{
		return $this->connection;
	}

54
}