grammar.php 857 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php namespace Laravel\Database\Schema\Grammars;
  2. use Laravel\Fluent;
  3. use Laravel\Database\Schema\Table;
  4. abstract class Grammar extends \Laravel\Database\Grammar {
  5. /**
  6. * Get the appropriate data type definition for the column.
  7. *
  8. * @param Fluent $column
  9. * @return string
  10. */
  11. protected function type(Fluent $column)
  12. {
  13. return $this->{'type_'.$column->type}($column);
  14. }
  15. /**
  16. * Wrap a value in keyword identifiers.
  17. *
  18. * @param Table|string $value
  19. * @return string
  20. */
  21. public function wrap($value)
  22. {
  23. // This method is primarily for convenience so we can just pass a
  24. // column or table instance into the wrap method without sending
  25. // in the name each time we need to wrap one of these objects.
  26. if ($value instanceof Table or $value instanceof Fluent)
  27. {
  28. $value = $value->name;
  29. }
  30. return parent::wrap($value);
  31. }
  32. }