예제 #1
0
파일: All.php 프로젝트: chris27tina/TODO
 public static function getLocation($record)
 {
     //not called/used for stories
     if (All::hasEditRight($record) && empty($record->location)) {
         return All::getNamedEditLink($record, '');
         //Elysium or Oblivion...
     } elseif (empty($record->location)) {
         return '';
         //Elysium
     } else {
         return $record->location;
     }
 }
예제 #2
0
});
Route::get('{resource}/{id}/api', function ($resource, $id) {
    return All::getRecord($resource, $id);
})->where('id', '[0-9]+');
Route::get('{resource}/{id}/edit/api', function ($resource, $id) {
    return All::getRecord($resource, $id);
})->where('id', '[0-9]+');
/*
|--------------------------------------------------------------------------
| Deleting via get Request
|--------------------------------------------------------------------------
|
*/
Route::get('{resource}/{id}/delete', function ($resource, $id) {
    $record = All::getRecord($resource, $id);
    if (All::hasEditRight($record)) {
        $record = All::getRecord($resource, $id);
        $record->delete();
        return Redirect::route($resource . '.index');
    }
})->where('id', '[0-9]+');
/*
|--------------------------------------------------------------------------
| Starring
|--------------------------------------------------------------------------
|
*/
Route::post('{resource}/{id}/star', function ($resource, $id) {
    //create rights bro
    $record = All::getRecord($resource, $id);
    return Starring::star($record);
예제 #3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit1($id)
 {
     $user = $this->user->find($id);
     // !All::hasEditRight($user) ? die : true;
     if (is_null($user)) {
         return Redirect::route('users.index');
     }
     if (All::hasEditRight($user)) {
         return View::make('users.edit', compact('user'));
     } else {
         return View::make('error.403');
     }
 }