diff --git a/BD/marcas de tiempo y resources.txt b/BD/marcas de tiempo y resources.txt new file mode 100644 index 0000000..f88126d --- /dev/null +++ b/BD/marcas de tiempo y resources.txt @@ -0,0 +1 @@ +https://view.genially.com/68c97d958c8712bbc24eb767 \ No newline at end of file diff --git a/app/Http/Controllers/CategoriasController.php b/app/Http/Controllers/CategoriasController.php index dab4c73..55ed3b0 100644 --- a/app/Http/Controllers/CategoriasController.php +++ b/app/Http/Controllers/CategoriasController.php @@ -9,24 +9,7 @@ use App\Models\Categorias; class CategoriasController extends Controller { - public function index(Request $request){ - - $categorias = Categorias::all(); - - // $categorias = Categorias::findOrFail(13); - //$cat = Categorias::where('id_categoria', 1)->first(); - //$categorias = Categorias::where('descripcion', 'Cursos, capacitaciones y formación')->get(); - //$categorias = Categorias::where('descripcion', 'like', '%Prod%')->get(); - - //$categorias = Categorias::orderBy('nombre', 'desc')->get(); - - //$categorias = Categorias::first(); - //$categorias = Categorias::last(); - /*Categorias::count();*/ - - - return view('categorias.index', ["categorias"=>$categorias]); - } + public function show($id){ $categoria = Categorias::findOrfail($id); return view('categorias.show', ["cat"=>$categoria]); @@ -39,9 +22,7 @@ class CategoriasController extends Controller } - public function create(){ - return view('categorias.new'); - } + public function store(Request $request){ diff --git a/app/Models/Categorias.php b/app/Models/Categorias.php index dc667fe..8fad31d 100644 --- a/app/Models/Categorias.php +++ b/app/Models/Categorias.php @@ -4,16 +4,18 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; - +use Illuminate\Database\Eloquent\SoftDeletes; class Categorias extends Model { use HasFactory; + use SoftDeletes; + protected $table = 'categorias'; public $primaryKey = 'id_categoria'; - public $timestamps = false; + public $timestamps = true; protected $fillable = [ 'nombre', 'descripcion', diff --git a/config/app.php b/config/app.php index 9207160..a7638f9 100644 --- a/config/app.php +++ b/config/app.php @@ -70,7 +70,8 @@ return [ | */ - 'timezone' => 'UTC', + //'timezone' => 'UTC', + 'timezone' => 'America/Argentina/Catamarca', /* |-------------------------------------------------------------------------- diff --git a/routes/web.php b/routes/web.php index a6d5ad0..1edef6e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -17,10 +17,14 @@ Route::get('/', function () { return view('welcome'); }); -Route::get('categorias', [CategoriasController::class, 'index'])->name('categorias.index'); +/*Route::get('categorias', [CategoriasController::class, 'index'])->name('categorias.index'); Route::post('categorias', [CategoriasController::class, 'store'])->name('categorias.store'); Route::get('categorias/create', [CategoriasController::class, 'create'])->name('categorias.create'); Route::get('categorias/{categoria}', [CategoriasController::class, 'show'])->name('categorias.show'); Route::delete('categorias/{categoria}', [CategoriasController::class, 'destroy'])->name('categorias.destroy'); Route::get('categorias/{categoria}/edit', [CategoriasController::class, 'edit'])->name('categorias.edit'); -Route::put('categorias/{categoria}', [CategoriasController::class, 'update'])->name('categorias.update'); +Route::put('categorias/{categoria}', [CategoriasController::class, 'update'])->name('categorias.update');*/ + + + +Route::resource('categorias', CategoriasController::class); \ No newline at end of file