Luego de mucho batallar ya hallamos el resultado de este apuro que ciertos lectores de nuestro sitio web tienen. Si tienes algún detalle que aportar no dudes en dejar tu información.
Ejemplo 1: tutorial de laravel crud
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use AppTicket;
class TicketController extends Controller
/**
* Display a listing of the resource.
*
* @return IlluminateHttpResponse
*/
public functionindex()$patients= Patient::where('user_id', auth()->user()->id)->get();return view('patients.index',compact('patients'));
/**
* Show the form for creating a new resource.
*
* @return IlluminateHttpResponse
*/
public functioncreate()return view('patients.create');
/**
* Store a newly created resource in storage.
*
* @param IlluminateHttpRequest $request
* @return IlluminateHttpResponse
*/
public function store(Request $request)$ticket= new Patient();$data=$this->validate($request, ['name'=>'required',
'surname'=>'required''id_number'=>'required']);$patient->savePatient($data);return redirect('/home')->with('success', 'New patient has been succesfully created');
/**
* Display the specified resource.
*
* @param int $id
* @return IlluminateHttpResponse
*/
public function show($id)
//
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return IlluminateHttpResponse
*/
public function edit($id)$patient= Patient::where('user_id', auth()->user()->id)
->where('id', $id)
->first();return view('patients.edit', compact('patient', 'id'));
/**
* Update the specified resource in storage.
*
* @param IlluminateHttpRequest $request
* @param int $id
* @return IlluminateHttpResponse
*/
public function update(Request $request, $id)$patient= new Patient();$data=$this->validate($request, ['name'=>'required',
'surname'=>'required''id_number'=>'required']);$data['id']=$id;$patient->updatePatient($data);return redirect('/home')->with('success', 'Patient Information was updated succesfully');
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return IlluminateHttpResponse
*/
public function destroy($id)$patient= Patient::find($id);$patient->delete();return redirect('/home')->with('success', 'The patient has been deleted!!');
Ejemplo 2: tutorial de laravel crud
@extends('layouts.app')
@section('content')<div class="container"><table class="table table-striped"><thead><tr><td>ID</td><td>Title</td><td>Description</td><td colspan="2">Action</td></tr></thead><tbody>
@foreach($patients as $patient)<tr><td>$ticket->id</td><td>$ticket->name</td><td>$ticket->surname</td><td><a href="action([email protected]',$patient->id)"class="btn btn-primary">Edit</a></td><td><form action="action('[email protected]', $patient->id)"method="post">csrf_field()<input name="_method"type="hidden"value="DELETE"><button class="btn btn-danger"type="submit">Delete</button></form></td></tr>
@endforeach
</tbody></table><div>
@endsection
Ejemplo 3: laravel crud
$ php artisan make:controller ContactController --resource
valoraciones y reseñas
Si te gustó nuestro trabajo, tienes el poder dejar un escrito acerca de qué le añadirías a esta crónica.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)