lundi 18 novembre 2019

laravel 5.4 Form doesn't show anything on localhost. and it also shows no any error message. It's blank

Description:

I downloaded and installed Form from https://laravelcollective.com/docs/5.4/html and configure all files as per instructions.

  Collective\Html\HtmlServiceProvider::class,

        'Form' => Collective\Html\FormFacade::class,
        'Html' => Collective\Html\HtmlFacade::class,

Problem:

My Route http://127.0.0.1:8000/admin/product/create is showing a blank page. In actual it should show me a Form. There is no any error message in all code or localhost.

HTML CODE:

@extends('admin.layout.admin')

@section('content')

    <h3>Add Product</h3>

    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            {!! Form::open(['route' => 'product.store', 'method' => 'POST', 'files' => true, 'data-parsley-validate'=>'']) !!}

            <div class="form-group">
                
                
            </div>

            <div class="form-group">
                
                
            </div>
            <div class="form-group">
                
                
            </div>

            <div class="form-group">
                
                
            </div>

            <div class="form-group">
                
                
            </div>

            <div class="form-group">
                
                
            </div>

             
            {!! Form::close() !!}

        </div>
    </div>



@endsection

product.php code

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    protected $fillable=['name','description','size','category_id','image','price'];

    public function category()
    {
        return $this->belongsTo(Category::class);
    }

    public function images()
    {
        return $this->hasMany(ProductImage::class);
    }

    public function reviews()
    {
        return $this->hasMany(ProductReview::class);
    }

    public function getStarRating()
    {
        $count = $this->reviews()->count();
        if(empty($count)){
            return 0;
        }
        $starCountSum=$this->reviews()->sum('rating');
        $average=$starCountSum/ $count;

       return $average;

    }

}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire