Kistlak

Kistlak

Member Since 8 Months Ago

Experience Points 610
Experience
Level
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

10 Mar
8 months ago

Kistlak left a reply on How To Solve This If And Else Statements Are Not Working In Jquery

@mironmg - Laravel Logs -

[2018-03-10 17:13:18] local.ERROR: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'date' cannot be null (SQL: insert into `seats` (`date`, `st`, `item`) values (, 10.30 am, 1)) {"exception":"[object] (Illuminate\Database\QueryException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'date' cannot be null (SQL: insert into `seats` (`date`, `st`, `item`) values (, 10.30 am, 1)) at D:\wamp64\www\FinalProject\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'date' cannot be null at D:\wamp64\www\FinalProject\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458)

And here is Git Link - https://github.com/Kistlak/FinalProject

Kistlak left a reply on How To Solve This If And Else Statements Are Not Working In Jquery

@mironmg - Still , if part is working. Else part is not working. Why is this happens ?? And how can I Fix this ??

Kistlak left a reply on How To Solve This If And Else Statements Are Not Working In Jquery

@mironmg - I want to implement, if someone booked a seat, others can't book that seat. Ex - John wants to book a seat number 10 on 25th January , 10.30am show. After he booked it , others can't book that seat number 10 on 25th January , 10.30am show. ( Like this one )

But , again Daniel wants to book a seat number 10 on 25th January , 1.30pm show.

Thats why , I check if the data is available in the database. And if data is available , he can't book those seats. If data is unique , he can book.

Kistlak left a reply on How To Solve This If And Else Statements Are Not Working In Jquery

@mironmg - I changed like you said. But , I am able to insert data which is already existing in the database. How can I Fix this ??

Kistlak left a reply on How To Solve This If And Else Statements Are Not Working In Jquery

@shez1983 - I have no idea how to do it as you are saying. Can you please implement it ?? Please..

Kistlak started a new conversation How To Solve This Check Database Value / Variable Availability In Laravel

I am creating a Ticket Reservation System and I want to check data availability from the Database. As usual, I used HTML form and when someone tries to insert data which is already in the database , I want to show them a message like "Seats not available". And If data is unique , I want to insert into the database. I have a function called btnShowNew in Seats.blade.php and when I click submit button it always shows me " if " part in that function. It means , it always shows Seats not available. " else " part is not working. IT measns , if data is unique , I am not able to insert into the database. ( Seat Number = Items )

Form and Seat Structure Image - https://i.stack.imgur.com/E3nf8.png

How can I Fix this ??

Here is my Seats.blade.php

<form class="form-horizontal" id="form1" method="POST" action="{{ route('seatsinsert') }}" enctype="multipart/form-data">    
    
    {{ csrf_field() }}    
        
        <div class="dt"> <br>
           
    <h4> <span id="success_message" class="text-success"></span> </h4>
    
    <div class="form-group row">
    <label for="example-date-input" class="col-2 col-form-label">Select Date :</label>
    <div class="col-10">
    <input class="form-control" type="date" name="date" placeholder="mm-dd-yyyy" id="example-date-input">
    </div>
    </div>
        
     <div class="form-group">
    <label for="exampleSelect1">Select Time :</label>
    <select name="st" class="form-control" id="exampleSelect1">
      <option>10.30 am</option>
    </select>
    </div>  
 
        </div>
            
      <h2 style="font-size:1.2em;font-family: Times New Roman;"> Choose seats by clicking below seats :</h2>
       
      <div id="holder"> 
    <ul id="place">
        </ul>    
      </div>
      
      <div style="width:600px;text-align:center;overflow:auto"> <br>
      
      <input type="submit" class="btn btn-primary" id="btnShowNew" value="Continue"> <br><br>

       <span id="availability"></span>          
    
    <script type="text/javascript">
        
        $(function () {

            $('#btnShowNew').click(function (e) {
                e.preventDefault();

                var items = [];
                $.each($('#place li.' + settings.selectingSeatCss + ' a'), function (index, value) {
                    items.push($(this).attr('title'));
                });

                    console.log(items);
                   // $(location).attr('href', 'Seats');

                   $.ajax({
                   url:'{{ route('seatprocess') }}',
                   type:"POST",
                   data:{ 
                   _token: "{{ csrf_token() }}", 
                   items: JSON.stringify(items), 
                   date: $('input[name=date]').val(), 
                   st: $('select[name=st]').val()},
                   success:function(data)
                   {
                    if(data !== '0')
                    {
                     $('#availability').html('<span class="text-danger">Seats not available</span>');
                     $('#btnShowNew').attr("disabled", true);
                    }
                    else
                    {
                     //$('#availability').html('<span class="text-success">Seats Available</span>');
                     
                    $.ajax({ 
                    type: "post", 
                    url: "{{ route('seatsinsert') }}", 
                    data: { 
                    _token: "{{ csrf_token() }}", 
                    items: JSON.stringify(items), 
                    date: $('input[name=date]').val(), 
                    st: $('select[name=st]').val()}, 
                    success: function(data){ 
                    $("form").trigger("reset"); 
                    $('#success_message').fadeIn().html("Text"); 
                    } 
                    });
                     
                    $('#btnShowNew').attr("disabled", false);
                    }
                   }
                  });
  
                }); //btnShowNew

         }); //Final 
    
    </script>
    
    </form>

Here is my SeatsController.php

public function seatsinsert(Request $request)
    {

        $date = $request->input('date');
        $st = $request->input('st');
        $items = $request->input('items'); 
        $items = str_replace(['[', ']', '"'], '', $items); 

        $user = new Seats(); 
        $user->date = $date; 
        $user->st = $st; 
        $user->item = $items; 

        $user->save();
  
    }  
    
    public function seatprocess(Request $request)
    {
    //dd($request->all());
    
    $date = $request->input('date');
    $st = $request->input('st');
    $items = $request->input('items');     
    
    $results = DB::table('seats')->where(['date' => $date, 'st' => $st, 'item' => $items])->get();

    echo $results;
    
    }
 }

Here are my Routes.

Route::post('seatsinsert',[
'uses'=> '[email protected]',
'as' => 'seatsinsert'
]);
Route::post('seatprocess',[
'uses'=> '[email protected]',
'as' => 'seatprocess'
]);
07 Mar
8 months ago

Kistlak left a reply on How To Pass Jquery Values To PHP In Laravel

@zozodev - Maybe I am doing this wrong way. How can I do possibly ??

Kistlak started a new conversation How To Pass Jquery Values To PHP In Laravel

I am creating a Ticket Reservation System and I want to insert data into the Database. As usual, I used HTML form and all the data goes to the database except seat numbers. And it doesn't give me an error. For the seat numbers, I used Jquery and I want to insert that Jquery values into the database. I don't know is this possible or not. ( Seat numbers = items )

How can I Fix this ??

Here is my Seat.blade.php

<form class="form-horizontal" id="form1" method="POST" action="{{ route('seatsinsert') }}" enctype="multipart/form-data">    

    {{ csrf_field() }}    

    <div class="dt"> <br>

        @if(session()->has('Msg'))
        <h4 class="alert alert-success"> {{ session()->get('Msg') }} </h4>
        @endif    

        <div class="form-group row">
            <label for="example-date-input" class="col-2 col-form-label">Select Date :</label>
            <div class="col-10">
                <input class="form-control" type="date" name="date" placeholder="mm-dd-yyyy" id="example-date-input">
            </div>
        </div>

        <div class="form-group">
            <label for="exampleSelect1">Select Time :</label>
            <select name="st" class="form-control" id="exampleSelect1">
                <option>10.30 am</option>
                <option>1.30 pm</option>
                <option>4.30 pm</option>
                <option>7.30 pm</option>
            </select>
        </div>  

    </div>

    <h2 style="font-size:1.2em;font-family: Times New Roman;"> Choose seats by clicking below seats :</h2>

    <div id="holder"> 
        <ul id="place">
        </ul>    
    </div>

    <input type="submit" class="btn btn-primary" id="btnShowNew" value="Continue"> <br><br>

    <script type="text/javascript">

        $(function () {

            $('#btnShowNew').click(function () {
                var str = [], item;
                $.each($('#place li.' + settings.selectingSeatCss + ' a'), function (index, value) {
                    var item = $(this).attr('title').var();
                    //str.push(item);                   
                    $.ajax({
                        type: "post",
                        url: "{{ route('seatsinsert') }}",
                        data: {items: item}
                    })

                });

                //alert(str.join(','));
            })
        });

    </script>
</form>

Here is my SeatController.php

public function seatsinsert(Request $request) {

$date = $request->input('date');
$st = $request->input('st');
$item = $request->input('items');
//$item = item;

$user = new Seats();
$user->date = $date;
$user->st = $st;
$user->item = $item;

$this->validate($request, [
    'date' => 'required'
]);

$user->save();

$request->session()->flash('Msg', 'Successfully Inserted !!');

return redirect('Seats');

}

Here are my Routes.

Route::post('seatsinsert', [
    'uses' => '[email protected]',
    'as' => 'seatsinsert'
]);
20 Feb
8 months ago

Kistlak left a reply on How To Solve This Data Update Error In Laravel

@MaverickChan - I fixed all of these things. But, still tells me 404 Not Found error. How can I Fix this ??

Kistlak left a reply on How To Solve This Data Update Error In Laravel

@Shawdow - I tried this. But , still give me the same error.

Kistlak left a reply on How To Solve This Data Update Error In Laravel

@Shawdow - I have no idea. can I Fix this ??

Kistlak left a reply on How To Solve This Data Update Error In Laravel

@mcangueiro - Yes. When I add a "/" , it gives 404 not found. Still not works..

Kistlak left a reply on How To Solve This Data Update Error In Laravel

@Shadow - I changed it. But , still I can't update data. It still gives me the same error. How can I Fix this ??

Kistlak left a reply on How To Solve This Data Update Error In Laravel

@wamae - Okay , can you explain about this $edd = User::find($id)->get(); ??

Kistlak left a reply on How To Solve This Data Update Error In Laravel

@Shadow - I changed it.. But, it still gives me the same error.

Kistlak left a reply on How To Solve This Data Update Error In Laravel

@MaverickChan - When I click Edit button in AdminPanel.blade.php it gives me all the details in AdminUpdate.blade.php. After I change the data and when I click the Update User button , it gives me this error. - " Sorry, the page you are looking for could not be found. "

Kistlak started a new conversation How To Solve This Data Update Error In Laravel

I'm creating a web site. And I have created a registration page. I want to update my details.

But, It tells me - Sorry, the page you are looking for could not be found.

How can I Fix this ??

Here is my AdminPanel.blade.php

<table class="table table-bordered">

<tr>
<td> Name </td>
</tr>


@foreach($data as $value )
<tr>
<td> {{ $value->username }} </td>
<td> <a href="edit/{{ $value->id }}"><input type="submit" name="update" value="Update" class="btn-primary"></a> </td>
</tr>
@endforeach
</table>

Here is my AdminPanelController.php

public function edit($id)
{
$edd = User::find($id);
//dd($edd);
      return view('AdminUpdate', ['edd' => $edd]);

}
    
    public function adminedit($id, Request $request)
{
    // Add Validation

    $users = User::find($id);
$users->username = $request->get('username');
$users->email = $request->get('email');
$users->save();

return redirect('AdminPanel');
}

Here is my AdminUpdate.blade.php

<form action="adminedit/{{ $edd[0]->id }}" method="post" enctype="multipart/form-data">

    {{ method_field('PUT') }}
    {{ csrf_field() }}

  <div class="form-group">
    <label>Username : *</label>
    <input type="text" class="form-control" name="username" value="{{$edd[0]->username}}" placeholder="Enter Your Username" required>
  </div>
    
    <div class="form-group">
    <label>Email : *</label>
    <input type="email" class="form-control" name="email" value="{{$edd[0]->email}}" placeholder="Enter Your Username" required>
  </div>
  
  <div class="form-group">
    <label>Password : *</label>
    <input type="password" class="form-control" name="password" value="{{$edd[0]->password}}" placeholder="Enter Your Password" required>
  </div>
  
  <div class="form-group">
    <label>Upload Profile Picture :</label>
    <input type="file" class="form-control-file" name="file_img" aria-describedby="fileHelp">
    <small id="fileHelp" class="form-text text-muted">If U Want , U Can Skip Upload A Profile Picture</small>
  </div>
  
  <input type="submit" class="btn btn-primary" value="Update User">
                    </form>

Here are my Routes.

Route::get('/edit/{id}', '[email protected]');

Route::post('/adminedit/{id}', '[email protected]');

Kistlak started a new conversation How To Solve This Trying To Get Property Of Non-object Error

I'm creating a web site. And I have created a registration page. I want to update my details.

But, It gives me this error and I have also uploaded a picture of errors below. - [Error Picture][1]

ErrorException (E_ERROR) Trying to get property of non-object (View: D:\wamp64\www\FinalProject\resources\views\AdminUpdate.blade.php)

I used dd($edd); and it gave me correct details. But, when I try with below codes it gives me that above error.

How can I Fix this ??

Here is my AdminPanel.blade.php

    <table class="table table-bordered">
    
    <tr>
    <td> Name </td>
    </tr>
    
    
    @foreach($data as $value )
    <tr>
    <td> {{ $value->username }} </td>
    <td> <a href="edit/{{ $value->id }}"><input type="submit" name="update" value="Update" class="btn-primary"></a> </td>
    </tr>
    @endforeach
    </table>

Here is my AdminPanelController.php

    public function edit($id)
    {
    $edd = User::find($id);
    //dd($edd);
          return view('AdminUpdate', ['edd' => $edd]);
    
    }
        
        public function adminedit($id, Request $request, User $user)
    {
        // Add Validation
    
        $users = $user->find($id);
        $users->username = $request->get('username');
        $users->email = $request->get('email');
        $users->save();
    
        return redirect()->back();
    }

Here is my AdminUpdate.blade.php

    <form action="edit/{{ $edd[0]->id }}" method="post" enctype="multipart/form-data">
    
        {{ method_field('PUT') }}
        {{ csrf_field() }}
    
      <div class="form-group">
        <label>Username : *</label>
        <input type="text" class="form-control" name="username" value="{{$edd[0]->username}}" placeholder="Enter Your Username" required>
      </div>
        
        <div class="form-group">
        <label>Email : *</label>
        <input type="email" class="form-control" name="email" value="{{$edd[0]->email}}" placeholder="Enter Your Username" required>
      </div>
      
      <div class="form-group">
        <label>Password : *</label>
        <input type="password" class="form-control" name="password" value="{{$edd[0]->password}}" placeholder="Enter Your Password" required>
      </div>
      
      <div class="form-group">
        <label>Upload Profile Picture :</label>
        <input type="file" class="form-control-file" name="file_img" aria-describedby="fileHelp">
        <small id="fileHelp" class="form-text text-muted">If U Want , U Can Skip Upload A Profile Picture</small>
      </div>
      
      <input type="submit" class="btn btn-primary" value="Update User">
                        </form>

Here are my Routes.

    Route::get('/edit/{id}', '[email protected]');
    
    Route::post('/edit/{id}', '[email protected]');
19 Feb
8 months ago

Kistlak left a reply on How To Solve This Image Insert

@Snapey - Now it's working.. Thank You !!

@Cronix - Okay , I got it.. Thank You !!

Kistlak left a reply on How To Solve This Update Error

@bobbybouwmann - I fixed that and still I get that error. How can I Fix this ??

@Snapey - I can't understand that. Can you explain more ??

Kistlak started a new conversation How To Solve This Update Error

I'm creating a web site. And I have created a registration page. I want to update my details.

But, It gives me this error - Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message

How can I Fix this ??

Here is my AdminPanel.blade.php

<table class="table table-bordered">

<tr>
<td> Name </td>
<td> Email </td>
<td> Images </td>
</tr>


@foreach($data as $value )
<tr>
<td> {{ $value->username }} </td>
<td> {{ $value->email }} </td>
<td> <img src='{{ $value->filemove }}' style='width:100px;height:100px;'> </td>
<td> <a href="edit/{{ $value->id }}"><input type="submit" name="update" value="Update" class="btn-primary"></a> </td>
<td> <a href="delete{{ $value->id }}"><input type="submit" name="delete" value="Delete" class="btn-danger"></a> </td>
</tr>
@endforeach
</table>

Here is my AdminUpdate.blade.php

 <form action="edit{{ $users[0]->id }}" method="post" enctype="multipart/form-data">

    {{ method_field('PUT') }}
    {{ csrf_field() }}

  <div class="form-group">
    <label>Username : *</label>
    <input type="text" class="form-control" name="username" value="{{$users[0]->username}}" placeholder="Enter Your Username" required>
  </div>
    
    <div class="form-group">
    <label>Email : *</label>
    <input type="email" class="form-control" name="email" value="{{$users[0]->email}}" placeholder="Enter Your Username" required>
  </div>
  
  <div class="form-group">
    <label>Password : *</label>
    <input type="password" class="form-control" name="password" value="{{$users[0]->password}}" placeholder="Enter Your Password" required>
  </div>
  
  <div class="form-group">
    <label>Upload Profile Picture :</label>
    <input type="file" class="form-control-file" name="file_img" aria-describedby="fileHelp">
    <small id="fileHelp" class="form-text text-muted">If U Want , U Can Skip Upload A Profile Picture</small>
  </div>
  
  @section('btnName',"Update") 
  <input type="submit" class="btn btn-primary" onclick="myFunction()" name="submit" value="@yield('btnName')">
                    </form>

Here is my AdminPanelController.php

<?php

namespace App\Http\Controllers;

use Auth;
use Illuminate\Http\Request;
use App\User;
use Validator;
use Illuminate\Support\Facades\Input;

class AdminPanelController extends Controller
{
    public function index()
    {
      $data = User::all();
      //$data = login::orderBy('created_at', 'desc')->get();
      return view('AdminPanel', ['data' => $data]);
    }
    
    public function adminedit(Request $request, $id)
    {
        $this->validate($request, [
            'email' => 'required'
        ]);
        
        $users = User::find($request['id']);
        $users->username = $request['username'];
        $users->email = $request['email'];
        $users->update();
        return redirect('AdminPanel');
        
       
    }
    
}

Here is my Route

Route::put('edit/{id}','[email protected]');
18 Feb
8 months ago

Kistlak left a reply on Undefined Variable: Data In View.

I fixed my AdminPanelController.php like this.

public function index()
    {
      $data = User::all();
      //$data = login::orderBy('created_at', 'desc')->get();
      return view('AdminPanel', ['data' => $data]);
    }

And after I did a php artisan view::clear as @Cronix said and problem solved.

Kistlak started a new conversation How To Solve This Image Insert

I'm creating a web site. And I have created a registration page. When I insert data, all the data successfully inserted into the database. But, images didn't insert into the database and not moved to the folder. How can I Fix this ??

Here is the AdminPanel.blade.php

<div class="panel-body">
 
  @if(session()->has('Msg'))
<h4 class="alert alert-success"> {{ session()->get('Msg') }} </h4>
@endif

@if(session()->has('OnlyImg'))
<h4 class="alert alert-success"> {{ session()->get('OnlyImg') }} </h4>
@endif  
    
    <form class="form-horizontal" method="POST" action="{{ route('adinsert') }}">

    {{ csrf_field() }}

  <div class="form-group">
    <label>Username : *</label>
    <input type="text" class="form-control" name="username" value="{{ old('username') }}" placeholder="Enter Your Username" required>
  </div>
    
    <div class="form-group">
    <label>Email : *</label>
    <input type="email" class="form-control" name="email" value="{{ old('email') }}" placeholder="Enter Your Username" required>
  </div>
  
  <div class="form-group">
    <label>Password : *</label>
    <input type="password" class="form-control" name="password" value="{{ old('password') }}" placeholder="Enter Your Password" required>
  </div>
  
  <div class="form-group">
    <label>Upload Profile Picture :</label>
    <input type="file" class="form-control-file" name="file_img" aria-describedby="fileHelp">
    <small id="fileHelp" class="form-text text-muted">If U Want , U Can Skip Upload A Profile Picture</small>
  </div>
  
  @section('btnName',"Insert") 
  <input type="submit" class="btn btn-primary" onclick="myFunction()" name="submit" value="@yield('btnName')">
                    
</form>
</div>

Here is the AdminPanelController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\User;
use Validator;
use Illuminate\Support\Facades\Input;

class AdminPanelController extends Controller
{
    public function index()
    {
      $data = User::all();
      //$data = login::orderBy('created_at', 'desc')->get();
      return view('AdminPanel', ['data' => $data]);
    }
    
public function adinsert(Request $request)
    {

        $username = $request->input('username');
        $email = $request->input('email');
        $password = $request->input('password');
        //$passen = bcrypt($password);
        
        $user = new User();
        $user->username = $username;
        $user->email = $email;
        $user->password = $password;
        
        $this->validate($request, [
            'email' => 'required'
        ]);
        
        if(Input::hasFile('file_img')){
            
            $file = Input::file('file_img');
            
            $rules = array(
                'file_img' => 'required|max:10000|mimes:doc,docx,jpeg,png,jpg'
            );
            
            $validator = Validator::make(Input::all(), $rules);
            
            if ($validator->fails()) {
                
                // redirect our user back with error messages
                
                // send back to the page with the input data and errors
                
                $request->session()->flash('OnlyImg', 'You Can Only Upload Images !!');
                return redirect('AdminPanel');
                
            }
            
            else if ($validator->passes()) {
                
                $fileimg = $file->getClientOriginalName();
                $destinationPath = 'img';
                $filemove = $file->move($destinationPath, $fileimg);
                
                $user->fileimg = $fileimg;
                $user->filemove = $filemove;
                
                $user->save();
                
                $request->session()->flash('Msg', 'Successfully Inserted !!');
                
                return redirect('AdminPanel');
                
            }
        }
        
        else
        {
            
            $user->save();
            
            $request->session()->flash('Msg', 'Successfully Inserted !!');
            
            return redirect('AdminPanel');
        }
  
    }    
    
}

Here is Route.

Route::post('adinsert',[
'uses'=> '[email protected]',
'as' => 'adinsert'
]);
14 Feb
8 months ago

Kistlak left a reply on Undefined Variable: Data In View.

@skliche -

<table class="table table-bordered">

<tr>
<td> Name </td>
<td> Email </td>
</tr>


<?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td> <?php echo e($value->name); ?> </td>
<td> <?php echo e($value->email); ?> </td>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</table>

Kistlak left a reply on Undefined Variable: Data In View.

@Snapey - Here it is..

<table class="table table-bordered">

<tr>
<td> Name </td>
<td> Email </td>
<td> Images </td>
</tr>


@foreach($data as $value )
<tr>
<td> {{ $value->name }} </td>
<td> {{ $value->email }} </td>
<td> <img src='{{ $value->filemove }}' style='width:100px;height:100px;'> </td>
<td> <a href="edit/{{ $value->id }}"><input type="submit" name="update" value="Update" class="btn-primary"></a> </td>
<td> <a href="delete{{ $value->id }}"><input type="submit" name="delete" value="Delete" class="btn-danger"></a> </td>
</tr>
@endforeach
</table>

Kistlak left a reply on Undefined Variable: Data In View.

@skliche - I have updated my Controller and routes as below. I didn't change View file and I still get same error as this - "Undefined variable: data (View: D:\wamp64\www\FinalProject\resources\views\AdminPanel.blade.php)"

AdminPanelController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\User;

class AdminPanelController extends Controller
{
    public function index()
    {
        $data = User::all();
        //$data = login::orderBy('created_at', 'desc')->get();
        return view('AdminPanel', ['data' => $data]);
    }
    
    public function logout(Request $request)
    {
     $request->session()->flush();
     return redirect('/login');
    }
       
}

Route

Route::get('/AdminPanel', 'AdminPanel[email protected]')->name('AdminPanel');
13 Feb
9 months ago

Kistlak left a reply on Undefined Variable: Data In View.

@skliche - Can demonstrate it plz ??

@arthurvillar - okay , I will check out..

Kistlak left a reply on Undefined Variable: Data In View.

@Cronix - When I goto AdminPanel page , I get this error.

@Snapey - Yes , I updated the question. How can I fix that ??

Kistlak left a reply on Undefined Variable: Data In View.

@skliche - I am very new to laravel.. Then I have no idea..

Kistlak left a reply on Undefined Variable: Data In View.

@tykus , @skliche - I have updated the question. Can u tell me the error ??

Kistlak started a new conversation Undefined Variable: Data In View.

I'm creating a web site using a Laravel. Now I want to view all the data from the database called users. But, I got this error always - Undefined variable: data (View: D:\wamp64\www\FinalProject\resources\views\AdminPanel.blade.php).

How can I fix this ??

Here is my Controller - AdminPanelController.php