samedi 31 mars 2018

How to handle this error : Class App\Http\Controllers\post/ProductController does not exist

Code in the blade file is given as below:

@extends('clientlayout.layouts.master1')
@section('title')
Register
@endsection
@section('content')
<div class="container" style="background-color: #c1bdba;max-width: 100% 
!important;">
<div class="row">
  <div class="offset-lg-2 col-lg-8 col-sm-8 col-8 border rounded main- 
  section"  style="background-color:rgba(19, 35, 47, 0.9);">
  <img src="client/images/decksys.png" alt="." style="margin: 20px 0px 20px 
350px;"> 
    <hr>
    <form class="container" action="/create" id="needs-validation" 
method="post" novalidate>
    <input type = "hidden" name = "_token" value = "<?php echo csrf_token(); 
 ?>">
      <div class="row">
        <div class="col-lg-6 col-sm-6 col-12">
           <div class="form-group">
            <label class="text-inverse custom" 
 for="validationCustom01">First Name
 <span class="req">*</span>
 </label>
<input type="text" name="firstname" class="form-control" 
id="validationCustom01"  placeholder="First name"
value="" required maxlength="25" onKeyPress="return ValidateAlpha(event);" 
style="background-color: rgba(19, 35, 47, 0.4); color:#fff;">
            <div class="invalid-feedback">
              Enter Your Firstname
            </div>
          </div>
        </div>

      </div> 
 </form>
   </div>
   </div>  
   </div>
   @endsection

The Controller code is shown below:

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\ProductController;


use Illuminate\Http\Request;

use DarthSoup\Whmcs\Facades\Whmcs;
use Darthsoup\Whmcs\WhmcsServiceProvider;

class ProductController extends Controller
{
 public function insertform(){
    return view('clientlayout.main.signup');
    } 

  public function insert(Request $request){

    $user = User::create([
        'firstname' => $data['firstname'],
        'lastname' => $data['lastname'],
        'email' => $data['email'],
        'city' => $data['city'],
        'dob' => $data['dob'],
        'password' => bcrypt($data['password']),
    ]);
    Whmcs::create($data->all());
    return redirect($this->create());

    echo "Record inserted successfully.<br/>";
    echo '<a href = "/insert">Click Here</a> to go back.';

    }

    }

The route code is given below and suggest me if any changes has to be made in the route.

Route::get('insert', 'ProductController@insertform');
Route::post('create','post/ProductController@insert');

Suggest me a solution to handle this error - "Product Controller doesn't Exit" and to get the output as follows:

Record inserted successfully



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

Aucun commentaire:

Enregistrer un commentaire