Skip to main content
7 de 8
título editado
user avatar
user avatar

"Class 'App\Models\Schema' not found",

me esta arrojando este error

"message": "Class 'App\Models\Schema' not found",

"exception": "Symfony\Component\Debug\Exception\FatalThrowableError",

"file": "C:\Bitnami\wampstack-7.3.12-0\apache2\htdocs\ct2\app\Models\CreaModel.php",

"line": 16

<?php

namespace App\Models;

use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Model;

class CreaModel extends Model
{
    function crearCampo($parametros){

      DB::beginTransaction();

      $data = array("nuevoCargo" => $parametros["nuevoCargo"],);

      $contacto = Schema::create('tbl_cargo_empleado', function (Blueprint $table) {
            $table->string($data);
        });

      if($contacto){

        DB::commit();
        return array("response" => true, "message" => "Campo Creado con Éxito.");

      }else{

        DB::rollBack();
        return array("response" => false, "message" => "Error al tratar de crear el Campo.");

      }
    }
}
José
  • 153
  • 1
  • 9