Monday, March 19, 2018

Laravel view doesn’t show anything it’show blank - development

Laravel view doesn’t show anything it’show blank

I have a view in the project but it doesn’t show anything, I want to show data in the table but the page is blank.it was working yesterday but its just a blank page,don’t know what happened, please help..

1.is it problem of route
2.database issue
3.html error

route

   <?php


Route::get('/', function () {
    return view('welcome');
});


Route::resource('books','BookController');
Route::resource('news','NewsController');
//Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
Route::get('my-home', 'HomeController@myHome');

Route::get('my-users', 'HomeController@myUsers');

Route::get('/news','NewsController@index');
Route::get('/news','NewsController@create');

Index.blade.php

  @extends('theme.default')

@section('content')

    <div class="row">

        <div class="col-lg-12">

            <h1 class="page-header">ADVERTISEMENT DETAILS</h1>

        </div>

        <!-- /.col-lg-12 -->

    </div>

    <!-- /.row -->

    <div class="row">

        <div class="col-lg-3 col-md-6">

            <div class="panel panel-primary">

                <div class="panel-heading">

                    <div class="row">

                        <a href="#">

                            <div class="panel-footer">

                                <span class="pull-left">Create New News</span>

                                <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>

                                <div class="clearfix"></div>

                            </div>

                        </a>

                    </div>

                </div>


            </div>

        </div>

        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        Added News
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="table-responsive">
                                    <table class="table table-striped table-bordered table-hover"
                                           id="dataTables-example">
                                        <thead>
                                        <tr>
                                            <th>Slno</th>
                                            <th>News Name</th>
                                            <th>News Details</th>
                                            <th>News Link</th>
                                            <th>News Status</th>
                                            <th>EDIT</th>
                                            <th>DELETE</th>
                                        </tr>
                                        </thead>
                                        <?php $i = 1; ?>
                                        <tbody>

                                        @foreach($news as $news)

                                            <tr>

                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                @if($news->status==0)
                                                    <td>ACTIVE</td>
                                                @else
                                                    <td>INACTIVE</td>
                                                @endif
                                                <td><a href=""><input type="button"
                                                                                                      name="edit"
                                                                                                      value="EDIT"> </a>
                                                <td><input type="button" name="delete" value="DELETE"></td>
                                            </tr>

                                        @endforeach
                                        </tbody>


                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- /. PAGE INNER  -->
    </div>

@endsection

my controller function

<?php

namespace AppHttpControllers;

use AppNews;
use IlluminateHttpRequest;

class NewsController extends Controller
{

    public function index()
    {
        $news=News::all();
        return view('news.index',['news'=>$news]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return IlluminateHttpResponse
     */
    public function create()
    {
//        return view('news.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  IlluminateHttpRequest  $request
     * @return IlluminateHttpResponse
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  AppNews  $news
     * @return IlluminateHttpResponse
     */
    public function show(News $news)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  AppNews  $news
     * @return IlluminateHttpResponse
     */
    public function edit(News $news)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  IlluminateHttpRequest  $request
     * @param  AppNews  $news
     * @return IlluminateHttpResponse
     */
    public function update(Request $request, News $news)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  AppNews  $news
     * @return IlluminateHttpResponse
     */
    public function destroy(News $news)
    {
        //
    }
}



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-view-doesnt-show-anything-itshow-blank/
via Lzo Media

No comments:

Post a Comment