Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ORDER:
- 1º Model: php artisan make:model Curso -m
- 2º Edit migration:
- Schema::create('cursos', function (Blueprint $table) {
- $table->increments('id');
- $table->string('titulo');
- $table->string('descricao');
- $table->string('imagem');
- $table->decimal('valor',5,2);
- $table->enum('publicado',['sim','nao'])->default('nao');
- $table->timestamps();
- });
- 3º Migrate:
- executar:
- > php artisan migrate
- > php artisan migrate:refresh --seed //reexecuta
- 4º Controller: php artisan make:controller Admin/CursoController
- 5º Seeds:
- criar: php artisan make:seeder UsersDadosSeeder
- executar:
- > php artisan db:seed //executa todos
- > php artisan db:seed --class=UsersTableSeeder //executa especifico
- ########### Commands ################
- >>>> php artisan make:controller PhotoController --resource
- CRIA AUTOMATICAMENTE OS METODOS GET POST DELETE PUT
- // Criar novo Controller
- > php artisan make:controller contatoController -m
- // Criar Migration
- > php artisan make:migration create_produtos_table --create=produtos
- // Cadastra Migrations no banco de dados
- > php artisan migrate
- //verificar requisições
- public function example(Request $req){
- dd($req->all());
- return view...
- //enviar variavel para view
- $contatos = [
- ["nome"=>"Maria", "tel"=>"1234"],
- ["nome"=>"Pedro", "tel"=>"4321"],
- ]
- return view('contato.index', compact('contatos'));
- ERRO: No application encryption key has been specified.
- php artisan key:generate
- php artisan config:cache
Advertisement
Add Comment
Please, Sign In to add comment