Ola boa tarde!
Fica dando esse erro:
Illuminate\Contracts\Container\BindingResolutionException
Target class [App\Http\Controllers\Request] does not exist.
ClienteController.php:
<?php
namespace App\Http\Controllers;
class ClienteController extends Controller
{
public function cadastro()
{
$cadastros = [
'Grey\'s Anatomy',
'Lost',
'Agents of SHIELD'
];
return view("cadastro.index", compact('cadastros'));
}
public function create()
{
return view('cadastro.create');
}
public function store(Request $request)
{
$nome = $request->nome;
$novo = new Orcamento();
$novo->nome = $nome;
var_dump($novo->save());
}
}
Orcamento.php:
<?php
namespace App;
use illuminate\Database\Eloquent\Model;
class Orcamento extends Model
{
protected $table = 'orcamentos';
public $timestamps = false;
}
web.php:
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\ClienteController;
Route::get('cliente',[ClienteController::class, 'cadastro']);
Route::get('cliente/criar',[ClienteController::class, 'create']);
Route::post('cliente/criar/',[ClienteController::class, 'store']);
2021_01_06_132127_criar_tabela_orcamentos.php:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CriarTabelaOrcamentos extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('orcamentos', function (Blueprint $table){
$table->string('nome');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('orcamentos');
}
}