/** * Seed the tags table */ public function run() { Table::truncate(); Table::create(['name' => 'users', 'sheetsu_url' => 'https://sheetsu.com/apis/f3b4ef5f', 'google_url' => 'https://docs.google.com/spreadsheets/d/1aERPe066OVhzt4vTVpo3e_F9y0OhFmiktBp3UmL7PvQ/edit#gid=0']); Table::create(['name' => 'posts', 'google_url' => 'https://docs.google.com/spreadsheets/d/1AQwg3T-krYmJjmu-dEX8ql8AS8H65tLqF7y9DVBXrpg/edit#gid=0', 'sheetsu_url' => 'https://sheetsu.com/apis/d2cc733e']); Table::create(['name' => 'user_friend_pivot', 'google_url' => 'https://docs.google.com/spreadsheets/d/1_sLyWSV38lVrueCIZPjBxy5rLbcrQcX8tyynuS-8cYk/edit#gid=0', 'sheetsu_url' => 'https://sheetsu.com/apis/c3684899']); }
public function store(Requests\TableRequest $request) { Table::create($request->all()); \Session::flash('flash_message', 'Your Data has been saved !!!'); return redirect('table'); }
public static function findOrCreate_pivotTable(Request $request, Table $model, Table $toModel) { //dd($model->namespace); $devis = Devis::find($request->devis_id); //$from_field_name = snake_case($model->model).'_id'; //$to_field_name = snake_case($toModel->model).'_id'; $models = array($model->model, $toModel->model); sort($models); $pivotTableName = strtolower($models[0] . '_' . $models[1]); $pivotTable = Self::where('devis_id', $devis->id)->where('name', $pivotTableName)->first(); if (!$pivotTable) { $pivotTable = Table::create(['name' => $pivotTableName, 'devis_id' => $devis->id, 'namespace_id' => $model->namespace_id]); } return $pivotTable; }