PHP Classes

File: src/views/crud/index.blade.php

Recommend this page to a friend!
  Classes of TJ Webb  >  Laravel CRUD Generator  >  src/views/crud/index.blade.php  >  Download  
File: src/views/crud/index.blade.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Laravel CRUD Generator
Generate MVC classes for any Laravel model
Author: By
Last change:
Date: 2 years ago
Size: 1,734 bytes
 

Contents

Class file image Download
@extends('crud::layout')
@section('header')
<div class="row">
    <div class="col-lg-12 margin-tb">
        <div class="pull-left">
            <h2>All {{Str::plural($modelName)}}</h2>
        </div>
        <div class="pull-right">
            <a class="btn btn-success" href="{{ route($routeRoot . '.create') }}"> Create New {{$modelName}}</a>
        </div>
    </div>
</div>
@endsection

@section('content')
<table class="table table-bordered">
    <tr>
        @foreach($fields as $field)
            <th>{{ $field->getDisplayName() }}</th>
        @endforeach
        <th width="280px">Action</th>
    </tr>
    @foreach ($models as $model)
        <tr>
            @foreach($fields as $field)
                <td>
                    @php
                        $value = $model->{$field->getColumnName()};
                        $fieldColumnName = $field->getColumnName();
                        $fieldDisplayName = $field->getDisplayName();
                    @endphp

                    @include(field_view($modelName, $field, 'index'))
                </td>
            @endforeach
            <td>
                <form action="{{ route($routeRoot . '.destroy', $model->id) }}" method="POST">
                    <a class="btn btn-info" href="{{ route($routeRoot . '.show', $model->id) }}">Show</a>
                    <a class="btn btn-primary" href="{{ route($routeRoot . '.edit', $model->id) }}">Edit</a>
                    @csrf
                    @method('DELETE')
                    <button type="submit" onclick="return confirm('Are you sure you want to delete this item?');" class="btn btn-danger">Delete</button>
                </form>
            </td>
        </tr>
    @endforeach
</table>
@endsection

For more information send a message to info at phpclasses dot org.