Skip to content

Instantly share code, notes, and snippets.

@ArtusC
Last active February 15, 2017 17:04
Show Gist options
  • Save ArtusC/a79fbd55dd0b9fe55aec76e98e014e52 to your computer and use it in GitHub Desktop.
Save ArtusC/a79fbd55dd0b9fe55aec76e98e014e52 to your computer and use it in GitHub Desktop.
** FLUXO LARAVEL ** ** FLUXO LARAVEL ** ** FLUXO LARAVEL **
BANCO_DE_DADOS <-----------------------------------------------------------------> LARAVEL <--------------------------------------------------------------------------------------> HTML
| | | | |
migrations: formam a estrutura do BD model: modelo de dados que estpa no BD e vai transitar no LARAVEL controller:vai transitar os dados entre o HTML e o BD routes: endereços do software que permitem transitar informação entre BACKEND e FRONTEND view: parte frontend que comanda o HTML
* Migrations: $ php artisan make:migration create_tasks_table --create=tasks => ex: php artisan make:migration create_enderecos_table --create=enderecos
* Model: $ php artisan make:model Task => ex: php artisan make:model Endereco
* Controller: $ php artisan make:controller TaskController => ex: php artisan make:controller EnderecoController
* Routes: Cria direto no repositório
* View: Cria direto no repositório
** Migrations + Model: $ php artisan make:model Task -m
*** Executando as migrations: $ php artisan migrate
!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!
* Criar novo projeto:
1) composer create-project laravel/laravel nome-do-projeto --prefer-dist
2) composer install
3) php artisan serve
* Baixar um projeto e dar update:
1) Ir até a página onde está o projeto (ex: bitbucket, github) e procurar por "Clone" ou pegar direto o ondereço onde está o projeto;
2) $ git clone ENDEREÇO_DO_PROJETO
3) $ composer update (DENTRO DA PASTA DO PROJETO)
!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!
* Dando permissão máxima para o projeto:
1) chmod -R 777 pasta-do-projeto (o -R indica que é um comando recursivo, se for em um só arquivo, tirar esse -R)
!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!
* Criando um Banco de Dados no MySQL:
1) $ mysql -u root -p
2) VAI PEDIR A SENHA
3) create database NOME_DO_DB => para criar o banco
4) drop database NOME_DO_DB => para excluir o banco
** Verificando se a conexão do DB está correta
1) php artisan tinker
2) DB::connection()->getDatabaseName() => SE APARECER O NOME DO DB, ESTÁ TUDO OK!
!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!----------------------------!!
* Criando novas versões no GIT
1) git add . => adiciona arquivos ao controle de versão GIT
2) git commit -m "COMENTÁRIO SOBRE O QUE FOI FEITO" => crio a nova versão modificada no GIT
3) git push => sincroniza com o servidor na nuvem
** Para atualizar a versão no meu local de trabalho
1) git pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment