03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Access Control List 36<br />

59 return $this;<br />

60 }<br />

61<br />

62 public function addForeign($key)<br />

63 {<br />

64 $this->addNullable("integer", $key);<br />

65 $this->getTable()->index($key);<br />

66 return $this;<br />

67 }<br />

68<br />

69 public function addBoolean($key)<br />

70 {<br />

71 return $this->addNullable("boolean", $key);<br />

72 }<br />

73<br />

74 public function addDateTime($key)<br />

75 {<br />

76 return $this->addNullable("dateTime", $key);<br />

77 }<br />

78<br />

79 public function addInteger($key)<br />

80 {<br />

81 return $this->addNullable("integer", $key);<br />

82 }<br />

83<br />

84 public function addString($key)<br />

85 {<br />

86 return $this->addNullable("string", $key);<br />

87 }<br />

88<br />

89 public function addText($key)<br />

90 {<br />

91 return $this->addNullable("text", $key);<br />

92 }<br />

93 }<br />

.<br />

This file should be saved as app/database/migrations/BaseMigration.php.<br />

We’re going to base all of our models off of a single BaseModel class. This will make it possible for<br />

us to reuse a lot of the repeated code we had before.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!