Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Both sides previous revision Vorhergehende Überarbeitung | |||
laravel:beispiel [2019/09/09 22:36] webproducer Primary Key hinzugefügt |
laravel:beispiel [2019/09/29 09:56] (aktuell) webproducer Quellcode-Korrektur |
||
---|---|---|---|
Zeile 14: | Zeile 14: | ||
<code php> | <code php> | ||
- | public function up() | + | public function up() |
- | { | + | { |
- | Schema::create('bundeslaender', function (Blueprint $table) { | + | Schema::create('bundeslaender', function (Blueprint $table) { |
- | $table->string('ID', 2 ); | + | $table->bigIncrements('id' ); |
- | $table->primary('ID' ); | + | $table->string( 'Bundeslandkuerzel', 2 ); |
- | $table->string( 'Bundesland', 25 ); | + | $table->string( 'Bundesland', 25 ); |
- | $table->float( 'Bearbeitungsgebuehr' ); | + | $table->float( 'Bearbeitungsgebuehr' ); |
- | }); | + | }); |
- | } | + | } |
</code> | </code> | ||
Zeile 53: | Zeile 53: | ||
<code php> | <code php> | ||
- | public function run() | + | public function run() |
- | { | + | { |
- | DB::table( 'bundeslaender' ) -> delete(); | + | DB::table( 'bundeslaender' ) -> delete(); |
- | DB::table( 'bundeslaender' ) -> insert( array( | + | DB::table( 'bundeslaender' ) -> insert( array( |
- | 0 => array( | + | 0 => array( |
- | 'ID' => 'BW', | + | 'Bundeslandkuerzel' => 'BW', |
- | 'Bundesland' => 'Baden Würtemmberg', | + | 'Bundesland' => 'Baden Würtemmberg', |
- | 'Bearbeitungsgebuehr' => 0.2 | + | 'Bearbeitungsgebuehr' => 0.2 |
- | ), | + | ), |
- | 1 => array( | + | 1 => array( |
- | 'ID' => 'BY', | + | 'Bundeslandkuerzel' => 'BY', |
- | 'Bundesland' => 'Bayern', | + | 'Bundesland' => 'Bayern', |
- | 'Bearbeitungsgebuehr' => 0.25 | + | 'Bearbeitungsgebuehr' => 0.25 |
- | ), | + | ), |
- | 2 => array( | + | 2 => array( |
- | 'ID' => 'BE', | + | 'Bundeslandkuerzel' => 'BE', |
- | 'Bundesland' => 'Berlin', | + | 'Bundesland' => 'Berlin', |
- | 'Bearbeitungsgebuehr' => 0.5 | + | 'Bearbeitungsgebuehr' => 0.5 |
- | ) | + | ) |
- | )); | + | )); |
- | } | + | } |
</code> | </code> | ||
Zeile 79: | Zeile 79: | ||
<code php> | <code php> | ||
- | public function run() | + | public function run() |
- | { | + | { |
- | $this->call(BundeslaenderTableSeeder::class ); | + | $this->call(BundeslaenderTableSeeder::class ); |
- | } | + | } |
</code> | </code> | ||