Kistlak

Experience

450

0 Best Reply Awards

  • Member Since 1 Week Ago
  • 0 Lessons Completed
  • 0 Favorites

20th February, 2018

Kistlak left a reply on How To Solve This Data Update Error In Laravel • 3 days ago

@Snapey - Before click update button - http://localhost/FinalProject/public/edit/2

After click update button - http://localhost/adminedit/2

Kistlak left a reply on How To Solve This Data Update Error In Laravel • 3 days ago

@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 • 3 days ago

@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 • 3 days ago

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

Kistlak left a reply on How To Solve This Data Update Error In Laravel • 3 days ago

@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 • 3 days ago

@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 • 3 days ago

@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 • 3 days ago

@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 • 3 days ago

@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 • 3 days ago

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 left a reply on How To Solve This Trying To Get Property Of Non-object Error • 3 days ago

@thoasty - Thank U Very Much !! It Worked !!

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

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]');

19th February, 2018

Kistlak left a reply on How To Solve This Image Insert • 4 days ago

@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 • 4 days ago

@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 • 4 days ago

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]');

18th February, 2018

Kistlak left a reply on Undefined Variable: Data In View. • 5 days ago

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 • 5 days ago

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'
]);

14th February, 2018

Kistlak left a reply on Undefined Variable: Data In View. • 1 week ago

@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. • 1 week ago

@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. • 1 week ago

@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', '[email protected]')->name('AdminPanel');

13th February, 2018

Kistlak left a reply on Undefined Variable: Data In View. • 1 week ago

@skliche - Can demonstrate it plz ??

@arthurvillar - okay , I will check out..

Kistlak left a reply on Undefined Variable: Data In View. • 1 week ago

@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. • 1 week ago

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

Kistlak left a reply on Undefined Variable: Data In View. • 1 week ago

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

Kistlak started a new conversation Undefined Variable: Data In View. • 1 week ago

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

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.