예제 #1
0
    return View::make('cats/index')->with('cats', $cats);
});
Route::get('cats/breeds/{name}', function ($name) {
    $breed = Breed::whereName($name)->with('cats')->first();
    return View::make('cats/index')->with('breed', $breed)->with('cats', $breed->cats);
});
Route::get('cats/create', function () {
    $cat = new Cat();
    return View::make('cats.edit')->with('cat', $cat)->with('method', 'post');
});
Route::post('cats', function () {
    $cat = Cat::create(Input::all());
    return Redirect::to('cats/' . $cat->id)->with('message', 'Profil został utworzony!');
});
Route::get('cats/{id}', function ($id) {
    $cat = Cat::find($id);
    return View::make('cats.single')->with('cat', $cat);
});
Route::get('cats/{cat}/edit', function (Cat $cat) {
    return View::make('cats.edit')->with('cat', $cat)->with('method', 'put');
});
Route::get('cats/{cat}/delete', function (Cat $cat) {
    return View::make('cats.edit')->with('cat', $cat)->with('method', 'delete');
});
Route::put('cats/{cat}', function (Cat $cat) {
    $cat->update(Input::all());
    return Redirect::to('cats/' . $cat->id)->with('message', 'Profil został uaktualniony!');
});
Route::delete('cats/{cat}', function (Cat $cat) {
    $cat->delete();
    return Redirect::to('cats')->with('message', 'Profil został usunięty!');
예제 #2
0
 public function getCaTbuscar($id)
 {
     $auxcat = Cat::find($id);
     $title = "Busqueda por categoria: " . $auxcat->cat_desc;
     $art = Items::leftJoin('miscelanias as m', 'm.item_id', '=', 'item.id')->leftJoin('images as i', 'm.id', '=', 'i.misc_id')->groupBy('item.id')->where('item.item_cat', '=', $id)->where('item.deleted', '=', 0)->get(array('item.id', 'item.item_nomb', 'item.item_desc', 'item.item_precio', 'item.item_cod', 'i.image'));
     return View::make('indexs.busq')->with('title', $title)->with('art', $art)->with('busq', $auxcat->cat_desc);
 }
예제 #3
0
 public function postElimCat()
 {
     if (Request::ajax()) {
         $id = Input::get('id');
         $cat = Cat::find($id);
         $cat->deleted = 1;
         $cat->save();
         return Response::json(array('type' => 'success', 'msg' => 'Categoría eliminada correctamente'));
     }
 }