public function action_index() { $record = new Paintings(); $record->topic = $_POST['topic']; $record->style = $_POST['style']; $record->save(); $array = array('success' => 'true', 'msg' => 'Record added successfully'); $json = json_encode($array); return $json; }
public function run() { $faker = Faker\Factory::create(); Paintings::truncate(); for ($i = 0; $i < 50; $i++) { $paintings = Paintings::create(array('title' => $faker->realText(rand(20, 40)), 'artist' => $faker->name, 'year' => $faker->year)); } }
public function put_index() { $data = file_get_contents('php://input'); $temp = json_decode($data); $new = Paintings::find($temp->id); $new->id = $temp->id; $new->topic = $temp->topic; $new->style = $temp->style; $new->save(); $array = array('success' => 'true'); $json = json_encode($array); return $json; }
// as seen in line 22 }); Route::get('graphic-design', function () { return View::make('graphic-design'); //in this case, we have named our route to directions // as seen in line 22 }); Route::get('signup', function () { return View::make('signup'); //in this case, we have named our route to directions // as seen in line 22 }); Route::post('thanks', function () { $theEmail = Input::get('email'); return View::make('thanks')->with('theEmail', $theEmail); //in this case, we have named our route to directions // as seen in line 22 }); Route::get('data', function () { /* $painting = Paintings::find(1); $painting->title = 'Do no wrong - Just do right'; $painting->save(); return $painting->title; */ echo '<pre>'; $paintings = Paintings::where('year', '2011')->get(); var_dump($paintings->toArray()); echo '</pre>'; //return $paintings; });