public function delete_paintings_delete($painting_id) { $painting = Painting::find($painting_id); $errors = new Laravel\Messages(); if ($painting) { if ($painting->delete_painting()) { return Redirect::to(URL::to_route('dashboard.paintings'))->with('status_success', __('application.painting_deleted')); // } // if ($painting->delete()) { // $directory = path('public').'uploads/paintings/'.sha1($name); // File::rmdir($directory); // return Redirect::to(URL::to_route('dashboard.paintings')) // ->with('status_success', __('application.painting_deleted')); } else { $errors->add('errors', __('application.generic_error')); return Redirect::to(URL::to_route('dashboard.paintings'))->with_errors($errors); } } else { return Response::error(404); } }
return View::make('hello', array('theLocation' => 'NYC', 'theWeather' => 'stormy', 'theLandmarks' => $theLandmarks)); }); Route::get('insert', function () { $painting = new Painting(); $painting->title = 'Do No Wrong'; $painting->artist = "D. DoRight"; $painting->year = 2014; $painting->save(); return 'Record Inserted Succefully.'; }); Route::get('find', function () { $painting = Painting::find(2); return $painting->title; }); Route::get('change', function () { $painting = Painting::find(2); $painting->title = 'Be Successful'; $painting->save(); return 'Title changed to ' . $painting->title; }); Route::get('about', function () { return 'This is the About Page.'; }); Route::get('about/directions', function () { return 'This is the Directions Page.'; }); Route::get('about/{theSubject}', function ($theSubject) { return $theSubject . ' content goes here.'; }); Route::get('about/classes/{theSubject}', function ($theSubject) { return "Content about {$theSubject} goes here.";
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the Closure to execute when that URI is requested. | */ Route::get('/', function () { $painting = Painting::find(1); $painting->title = 'Do No Wrong - Just Do Right'; $painting->save(); return $painting->title; /* $painting = new Painting; $painting->title = 'Do No Wrong'; $painting->artist = 'D. DoRight'; $painting->date = 2014; $painting->save(); return View::make('hello'); */ }); Route::get('about', function () { return 'About content goes here'; }); Route::get('about/directions', function () {