मैं दो स्तंभों पर एक अद्वितीय बाधा कैसे निर्धारित कर सकता हूं?
class MyModel extends Migration {
public function up()
{
Schema::create('storage_trackers', function(Blueprint $table) {
$table->increments('id');
$table->string('mytext');
$table->unsignedInteger('user_id');
$table->engine = 'InnoDB';
$table->unique('mytext', 'user_id');
});
}
}
MyMode::create(array('mytext' => 'test', 'user_id' => 1);
// this fails??
MyMode::create(array('mytext' => 'test', 'user_id' => 2);
लारवेल 4 के
—
कार्बनिक अधिवक्ता
विवरण का यह स्तर लारावेल डॉक्स से दुखी है । इसे पारित करने में उल्लेख करना इतना आसान होगा। इस तरह के विवरण और - उदाहरण के लिए - यह तथ्य कि रूपरेखा हमेशा यह मानती है कि प्रत्येक तालिका में ऑटो-इन्क्रिमिंग होने वाली है
—
कार्टिफ़ोर्सहोर्स
id
, रूपरेखा को किनारों के चारों ओर एक शौकिया भावना दे। क्या मैं रंटिंग हूं? :-(