source code laravel crud code example
Example 1: laravel crud tutorial
@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(PatientController@edit',$patient->id)}}" class="btn btn-primary">Edit</a></td>
<td>
<form action="{{action('PatientController@destroy', $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
Example 2: laravel crud operation step by step
<!-- create.blade.php -->
@extends('layout')
@section('content')
<style>
.uper {
margin-top: 40px;
}
</style>
<div class="card uper">
<div class="card-header">
Add Games Data
</div>
<div class="card-body">
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div><br />
@endif
<form method="post" action="{{ route('games.store') }}">
<div class="form-group">
@csrf
<label for="country_name">Game Name:</label>
<input type="text" class="form-control" name="name"/>
</div>
<div class="form-group">
<label for="cases">Price :</label>
<input type="text" class="form-control" name="price"/>
</div>
<button type="submit" class="btn btn-primary">Add Game</button>
</form>
</div>
</div>
@endsection