dimanche 27 août 2017

Error While Fetching db using eloquent

I have Tried to fetch data from MySQL db using eloquent in my laravel application it shows Parse Error here my code :
Model:

namespace App;

use Illuminate\Database\Eloquent\Model;

class design extends Model { //Table Name protected $table='designs'; //Primary key public $primarykey='id'; // TimeStamp public $timestamps=true; }

Controller Page:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\design;

class designController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
        $design=design::all();
        //$design = design::select('Design No','Design Name','Chain Weight/Length','status')->where('status','=','Active')->get();
        return view('pages.design')->with('design',$design);
    }
}

page for listing:
the error occurring while using for-each

@extends('layouts.layout')

    @section('content')
        <div class="main">
            <div class="container col-md-12 col-sm-12 col-xs-12">
                <h2 class="text-center">Designs</h2>
                    @if(count($design)>=1)
                    <h2>Done</h2>
                        <div class="table-responsive">
                            <table class="table table-striped table-hover table-bordered">
                                <thead>
                                    <tr>
                                        <th>Design No</th>
                                        <th>Design Name</th>
                                        <th>Weight/Lenght</th>
                                        <th>Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                @foreach($design as $design)
                                    <tr>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td>
                                            <button type="button" class="btn btn-warning">Edit</button>
                                            <button type="button" class="btn btn-danger"></button>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    @endif
            </div>
        </div>
    @endsection



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2wUArZu
via IFTTT

Aucun commentaire:

Enregistrer un commentaire