Skip to content

Commit c8257de

Browse files
committed
Laravel 5.6, Dingo/api, jwt-auth, Repository pattern
0 parents  commit c8257de

File tree

100 files changed

+16672
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+16672
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.yml]
15+
indent_style = space
16+
indent_size = 2

.env.example

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
9+
DB_CONNECTION=mysql
10+
DB_HOST=127.0.0.1
11+
DB_PORT=3306
12+
DB_DATABASE=homestead
13+
DB_USERNAME=homestead
14+
DB_PASSWORD=secret
15+
16+
BROADCAST_DRIVER=log
17+
CACHE_DRIVER=file
18+
SESSION_DRIVER=file
19+
SESSION_LIFETIME=120
20+
QUEUE_DRIVER=sync
21+
22+
REDIS_HOST=127.0.0.1
23+
REDIS_PASSWORD=null
24+
REDIS_PORT=6379
25+
26+
MAIL_DRIVER=smtp
27+
MAIL_HOST=smtp.mailtrap.io
28+
MAIL_PORT=2525
29+
MAIL_USERNAME=null
30+
MAIL_PASSWORD=null
31+
MAIL_ENCRYPTION=null
32+
33+
PUSHER_APP_ID=
34+
PUSHER_APP_KEY=
35+
PUSHER_APP_SECRET=
36+
PUSHER_APP_CLUSTER=mt1
37+
38+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
39+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored
4+
*.js linguist-vendored
5+
CHANGELOG.md export-ignore

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
/.idea
7+
/.vscode
8+
/.vagrant
9+
Homestead.json
10+
Homestead.yaml
11+
npm-debug.log
12+
yarn-error.log
13+
.env

Vagrantfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
require 'json'
5+
require 'yaml'
6+
7+
VAGRANTFILE_API_VERSION ||= "2"
8+
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
9+
10+
homesteadYamlPath = File.expand_path("Homestead.yaml", File.dirname(__FILE__))
11+
homesteadJsonPath = File.expand_path("Homestead.json", File.dirname(__FILE__))
12+
afterScriptPath = "after.sh"
13+
aliasesPath = "aliases"
14+
15+
require File.expand_path(confDir + '/scripts/homestead.rb')
16+
17+
Vagrant.require_version '>= 1.9.0'
18+
19+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
20+
if File.exist? aliasesPath then
21+
config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
22+
config.vm.provision "shell" do |s|
23+
s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases"
24+
end
25+
end
26+
27+
if File.exist? homesteadYamlPath then
28+
settings = YAML::load(File.read(homesteadYamlPath))
29+
elsif File.exist? homesteadJsonPath then
30+
settings = JSON.parse(File.read(homesteadJsonPath))
31+
else
32+
abort "Homestead settings file not found in #{confDir}"
33+
end
34+
35+
Homestead.configure(config, settings)
36+
37+
if File.exist? afterScriptPath then
38+
config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
39+
end
40+
41+
if defined? VagrantPlugins::HostsUpdater
42+
config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
43+
end
44+
end

after.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
# If you would like to do some extra provisioning you may
4+
# add any commands you wish to this file and they will
5+
# be run after the Homestead machine is provisioned.

aliases

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
alias ..="cd .."
2+
alias ...="cd ../.."
3+
4+
alias h='cd ~'
5+
alias c='clear'
6+
alias art=artisan
7+
8+
alias phpspec='vendor/bin/phpspec'
9+
alias phpunit='vendor/bin/phpunit'
10+
alias serve=serve-laravel
11+
12+
alias xoff='sudo phpdismod -s cli xdebug'
13+
alias xon='sudo phpenmod -s cli xdebug'
14+
15+
function artisan() {
16+
php artisan "$@"
17+
}
18+
19+
function dusk() {
20+
pids=$(pidof /usr/bin/Xvfb)
21+
22+
if [ ! -n "$pids" ]; then
23+
Xvfb :0 -screen 0 1280x960x24 &
24+
fi
25+
26+
php artisan dusk "$@"
27+
}
28+
29+
function php56() {
30+
sudo update-alternatives --set php /usr/bin/php5.6
31+
}
32+
33+
function php70() {
34+
sudo update-alternatives --set php /usr/bin/php7.0
35+
}
36+
37+
function php71() {
38+
sudo update-alternatives --set php /usr/bin/php7.1
39+
}
40+
41+
function php72() {
42+
sudo update-alternatives --set php /usr/bin/php7.2
43+
}
44+
45+
function serve-apache() {
46+
if [[ "$1" && "$2" ]]
47+
then
48+
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
49+
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-apache.sh
50+
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-apache.sh "$1" "$2" 80 443 "${3:-7.1}"
51+
else
52+
echo "Error: missing required parameters."
53+
echo "Usage: "
54+
echo " serve-apache domain path"
55+
fi
56+
}
57+
58+
function serve-laravel() {
59+
if [[ "$1" && "$2" ]]
60+
then
61+
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
62+
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-laravel.sh
63+
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-laravel.sh "$1" "$2" 80 443 "${3:-7.1}"
64+
else
65+
echo "Error: missing required parameters."
66+
echo "Usage: "
67+
echo " serve domain path"
68+
fi
69+
}
70+
71+
function serve-proxy() {
72+
if [[ "$1" && "$2" ]]
73+
then
74+
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-proxy.sh
75+
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-proxy.sh "$1" "$2" 80 443 "${3:-7.1}"
76+
else
77+
echo "Error: missing required parameters."
78+
echo "Usage: "
79+
echo " serve-proxy domain port"
80+
fi
81+
}
82+
83+
function serve-silverstripe() {
84+
if [[ "$1" && "$2" ]]
85+
then
86+
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
87+
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-silverstripe.sh
88+
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-silverstripe.sh "$1" "$2" 80 443 "${3:-7.1}"
89+
else
90+
echo "Error: missing required parameters."
91+
echo "Usage: "
92+
echo " serve-silverstripe domain path"
93+
fi
94+
}
95+
96+
function serve-spa() {
97+
if [[ "$1" && "$2" ]]
98+
then
99+
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
100+
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-spa.sh
101+
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-spa.sh "$1" "$2" 80 443 "${3:-7.1}"
102+
else
103+
echo "Error: missing required parameters."
104+
echo "Usage: "
105+
echo " serve-spa domain path"
106+
fi
107+
}
108+
109+
function serve-statamic() {
110+
if [[ "$1" && "$2" ]]
111+
then
112+
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
113+
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-statamic.sh
114+
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-statamic.sh "$1" "$2" 80 443 "${3:-7.1}"
115+
else
116+
echo "Error: missing required parameters."
117+
echo "Usage: "
118+
echo " serve-statamic domain path"
119+
fi
120+
}
121+
122+
function serve-symfony2() {
123+
if [[ "$1" && "$2" ]]
124+
then
125+
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
126+
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-symfony2.sh
127+
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-symfony2.sh "$1" "$2" 80 443 "${3:-7.1}"
128+
else
129+
echo "Error: missing required parameters."
130+
echo "Usage: "
131+
echo " serve-symfony2 domain path"
132+
fi
133+
}
134+
135+
function serve-symfony4() {
136+
if [[ "$1" && "$2" ]]
137+
then
138+
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
139+
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-symfony4.sh
140+
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-symfony4.sh "$1" "$2" 80 443 "${3:-7.1}"
141+
else
142+
echo "Error: missing required parameters."
143+
echo "Usage: "
144+
echo " serve-symfony4 domain path"
145+
fi
146+
}
147+
148+
function serve-pimcore() {
149+
if [[ "$1" && "$2" ]]
150+
then
151+
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
152+
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-pimcore.sh
153+
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-pimcore.sh "$1" "$2" 80 443 "${3:-7.1}"
154+
else
155+
echo "Error: missing required parameters."
156+
echo "Usage: "
157+
echo " serve-pimcore domain path"
158+
fi
159+
}
160+
161+
function share() {
162+
if [[ "$1" ]]
163+
then
164+
ngrok http ${@:2} -host-header="$1" 80
165+
else
166+
echo "Error: missing required parameters."
167+
echo "Usage: "
168+
echo " share domain"
169+
echo "Invocation with extra params passed directly to ngrok"
170+
echo " share domain -region=eu -subdomain=test1234"
171+
fi
172+
}
173+
174+
function flip() {
175+
sudo bash /vagrant/vendor/laravel/homestead/scripts/flip-webserver.sh
176+
}
177+
178+
function __has_pv() {
179+
$(hash pv 2>/dev/null);
180+
181+
return $?
182+
}
183+
184+
function __pv_install_message() {
185+
if ! __has_pv; then
186+
echo $1
187+
echo "Install pv with \`sudo apt-get install -y pv\` then run this command again."
188+
echo ""
189+
fi
190+
}
191+
192+
function dbexport() {
193+
FILE=${1:-/vagrant/mysqldump.sql.gz}
194+
195+
# This gives an estimate of the size of the SQL file
196+
# It appears that 80% is a good approximation of
197+
# the ratio of estimated size to actual size
198+
SIZE_QUERY="select ceil(sum(data_length) * 0.8) as size from information_schema.TABLES"
199+
200+
__pv_install_message "Want to see export progress?"
201+
202+
echo "Exporting databases to '$FILE'"
203+
204+
if __has_pv; then
205+
ADJUSTED_SIZE=$(mysql --vertical -uhomestead -psecret -e "$SIZE_QUERY" 2>/dev/null | grep 'size' | awk '{print $2}')
206+
HUMAN_READABLE_SIZE=$(numfmt --to=iec-i --suffix=B --format="%.3f" $ADJUSTED_SIZE)
207+
208+
echo "Estimated uncompressed size: $HUMAN_READABLE_SIZE"
209+
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables 2>/dev/null | pv --size=$ADJUSTED_SIZE | gzip > "$FILE"
210+
else
211+
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables 2>/dev/null | gzip > "$FILE"
212+
fi
213+
214+
echo "Done."
215+
}
216+
217+
function dbimport() {
218+
FILE=${1:-/vagrant/mysqldump.sql.gz}
219+
220+
__pv_install_message "Want to see import progress?"
221+
222+
echo "Importing databases from '$FILE'"
223+
224+
if __has_pv; then
225+
pv "$FILE" --progress --eta | zcat | mysql -uhomestead -psecret 2>/dev/null
226+
else
227+
cat "$FILE" | zcat | mysql -uhomestead -psecret 2>/dev/null
228+
fi
229+
230+
echo "Done."
231+
}
232+
233+
function xphp() {
234+
(php -m | grep -q xdebug)
235+
if [[ $? -eq 0 ]]
236+
then
237+
XDEBUG_ENABLED=true
238+
else
239+
XDEBUG_ENABLED=false
240+
fi
241+
242+
if ! $XDEBUG_ENABLED; then xon; fi
243+
244+
php \
245+
-dxdebug.remote_host=192.168.10.1 \
246+
-dxdebug.remote_autostart=1 \
247+
"$@"
248+
249+
if ! $XDEBUG_ENABLED; then xoff; fi
250+
}

0 commit comments

Comments
 (0)