In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "Laravel development case analysis", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Laravel development case analysis" bar!
Prepare the development environment
The original tutorial uses the officially recommended Homestead development environment. Due to the recent popularity of Docker, and there are corresponding containers for Laravel. Therefore, this paper takes Laradock as the development environment.
Install Laradock
Clone the Laradock repository locally.
Gitclone https://github.com/laradock/laradock.git
The final folder structure should look like this:
+ laradock
+ project-z
Configure Laradock
Copy Profil
Bashcdlaradockcpenv-example.env# replication profile
Enter Workspace
Bash# runs Laradockdocker-composeup-dnginx# to enter LaradockWorkspacedocker-composeexec--user=laradockworkspacebash#ForGitBashwinptydocker-composeexec--user=laradockworkspacebash
Configure domestic accelerated images
# Workspace
Composerconfig-gl# View composer Settings
Composerconfig-grepo.packagistcomposer https://mirrors.aliyun.com/composer/# sets domestic accelerated image
Build a page
Create an application
# Workspace
Composercreate-projectlaravel/laravelweibo--prefer-dist "5.8.*"
Configure the Nginx domain name
Cpnginx/sites/laravel.conf.examplenginx/sites/weibo.conf
Change the path in the newly copied configuration file to the project path that will be created.
Modify Host
Edit C:/Windows/System32/Drivers/etc/hosts
Add a 127.0.0.1weibo.test
.env file
The .env file contains some settings for the project, and we make some changes.
APP_NAME=Weibo
APP_ENV=local
APP_KEY=base64:nsvnM5l0N5cOzT/dFqfUoYlkYffhDPnKPuYU4AWMdPc=
APP_DEBUG=true
APP_URL= http://weibo.test
For convenience, we use the sqlite database locally.
Comment out the original DB settings and add the following
DB_CONNECTION=sqlite
DB_DATABASE=/database/database.sqlite
And create the corresponding database file
Touchdatabase/database.sqlite
Use Git to manage code
Cdweibo
Gitinit
Gitadd-A
Gitcommit-m "Initialcommit"
Upload to Gitee
Gitremoteaddorigingit@gitee.com:codingbit/weibo.git
Gitpush-uoriginmaster
Deploy applications using Heroku
You need to install the heroku-cli tool first.
Create HerokuApp
Herokucreate
Configure the Procfile file:
Echoweb:vendor/bin/heroku-php-apache2public/ > Procfile
Gitadd-A
Gitcommit-m "ProcfileforHeroku"
Gitpush
Herokubuildpacks:setheroku/php
Generate AppKey
# Workspace
$phpartisankey:generate--show
Base64:ta1aE+E8kuyDFlURbUrHEtL4HY71WtoffyNgUKldMWw=
# Host
Herokuconfig:setAPP_KEY=base64:ta1aE+E8kuyDFlURbUrHEtL4HY71WtoffyNgUKldMWw=
Push to Heroku
Gitpushherokumaster
If the upload is successful, you can see the effect by visiting the address https://cbit-weibo.herokuapp.com/.
Unified code style
Unify the code style through the editor's EditorConfig plug-in.
.editorconfig
Root=true
[*]
Charset=utf-8
End_of_line=lf
Insert_final_newline=true
Indent_style=space
Indent_size=4
Trim_trailing_whitespace=true
[* .md]
Trim_trailing_whitespace=false
[* .yml]
Indent_size=2
[*. {js,html,blade.php,css,scss}]
Indent_style=space
Indent_size=2
Static page
When the shelves are set up, start learning to create basic static pages.
Create a new branch
Gitcheckoutmaster
Gitcheckout-bstatic-pages
Remove useless views
Default welcome.blade.php view file, useless, delete.
Rmresources/views/welcome.blade.php
Configure routin
Routes/web.php
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.