예제 #1
0
 /**
  * Metodi hakee liitoskyselynä  muistutukset ja niiden tiedot, sekä muistukseen
  * liittyvän luokan. Metodi hakee myös kaikkien luokkien nimet.
  */
 public static function index()
 {
     $categories = Category::countAllRows();
     $todos = Todo::all();
     $data = array('todos' => $todos, 'categories' => $categories);
     View::make('reminders/reminders.html', $data);
 }
예제 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $todos = Todo::all();
     return $todos;
 }
예제 #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $todo = Todo::all();
     return View::make('users.show', compact('task'));
     //return View::make('users.index');
 }
예제 #4
0
class Todo extends ActiveRecord\Model
{
}
ActiveRecord\Config::initialize(function ($cfg) {
    $cfg->set_connections(array('development' => 'mysql://root:@localhost/todos'));
});
$app = new Slim();
function reqBody()
{
    global $app;
    return json_decode($app->request()->getBody(), true);
}
$app->get('/json', function () {
    echo json_encode(array_map(function ($todo) {
        return $todo->attributes();
    }, Todo::all()));
});
$app->post('/json', function () {
    $todo = new Todo(reqBody());
    $todo->save();
});
$app->get('/json/:id', function ($id) {
    echo Todo::find($id)->to_json();
});
$app->put('/json/:id', function ($id) {
    Todo::find($id)->update_attributes(reqBody());
});
$app->delete('/json/:id', function ($id) {
    Todo::find($id)->delete();
});
$app->get('/', function () {
 public function getIndex()
 {
     $todos = Todo::all();
     return View::make('index')->with('todos', $todos);
 }
예제 #6
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $todos = Todo::all();
     return View::make('todo.index', compact('todos'));
 }
예제 #7
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return Response::json(Todo::all());
 }
예제 #8
0
|--------------------------------------------------------------------------
|
| 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 () {
    return View::make('hello');
});
Route::get('/about', function () {
    return View::make('about', array('users' => ['Sai Kiran', 'Siva Sagar', 'Madhu Sai']));
});
Route::get('/master', function () {
    return View::make('master');
});
Route::get('/login', function () {
    return View::make('login');
});
Route::get('/todo', function () {
    $records = Todo::all();
    return View::make('todo', array('records' => $records));
});
Route::post('/todo', function () {
    ToDo::create(['task' => Input::get('task'), 'status' => 0, 'deadline' => Input::get('deadline')]);
    return View::make('todo', array('records' => ToDo::all()));
});
Route::get('/changeStat/{id}', ['uses' => 'ToDoController@changeStatus']);
Route::get('/sn/login', function () {
    return View::make('social_network/login');
});