2012-03-16 11:29:21 -05:00
|
|
|
<?php namespace Laravel\Database\Eloquent;
|
|
|
|
|
|
|
|
|
|
class Pivot extends Model {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The name of the pivot table's table.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
public $pivot_table;
|
|
|
|
|
|
2012-03-16 14:08:28 -05:00
|
|
|
/**
|
|
|
|
|
* Indicates if the model has update and creation timestamps.
|
|
|
|
|
*
|
|
|
|
|
* @var bool
|
|
|
|
|
*/
|
|
|
|
|
public static $timestamps = true;
|
|
|
|
|
|
2012-03-16 11:29:21 -05:00
|
|
|
/**
|
|
|
|
|
* Create a new pivot table instance.
|
|
|
|
|
*
|
|
|
|
|
* @param string $table
|
2012-05-02 09:37:40 -05:00
|
|
|
* @param string $connection
|
2012-03-16 11:29:21 -05:00
|
|
|
* @return void
|
|
|
|
|
*/
|
2012-05-02 09:37:40 -05:00
|
|
|
public function __construct($table, $connection = null)
|
2012-03-16 11:29:21 -05:00
|
|
|
{
|
|
|
|
|
$this->pivot_table = $table;
|
2012-08-09 22:10:49 -05:00
|
|
|
static::$connection = $connection;
|
2012-03-16 11:29:21 -05:00
|
|
|
|
|
|
|
|
parent::__construct(array(), true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the name of the pivot table.
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function table()
|
|
|
|
|
{
|
|
|
|
|
return $this->pivot_table;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|