/** * Run the database seeds. * * @return void */ public function run() { $prefixes = [1 => 'Продам', 2 => 'Куплю', 3 => 'Меняю', 4 => 'Предложение', 5 => 'Спрос']; foreach ($prefixes as $id => $title) { Prefix::create(['id' => $id, 'title' => $title]); } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $record = Prefix::find($id); $record->delete(); Session::flash('message', "Record deleted"); return Redirect::to('/prefix'); }
public function run() { DB::table('prefixes')->delete(); Prefix::create(array('title' => 'Mr.', 'user_id' => 1)); Prefix::create(array('title' => 'Mrs.', 'user_id' => 1)); }