Skip to content

Commit 2566152

Browse files
Scaffolding
1 parent 1520418 commit 2566152

35 files changed

+844
-375
lines changed

.env.example

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
APP_NAME=Laravel
1+
APP_NAME='Laravel, Intervention Image and DigitalOcean Spaces'
22
APP_ENV=local
33
APP_KEY=
44
APP_DEBUG=true
@@ -19,6 +19,9 @@ QUEUE_CONNECTION=sync
1919
SESSION_DRIVER=file
2020
SESSION_LIFETIME=120
2121

22+
FILESYSTEM_DRIVER=public
23+
IMAGE_DRIVER=gd
24+
2225
REDIS_HOST=127.0.0.1
2326
REDIS_PASSWORD=null
2427
REDIS_PORT=6379
@@ -37,6 +40,13 @@ AWS_SECRET_ACCESS_KEY=
3740
AWS_DEFAULT_REGION=us-east-1
3841
AWS_BUCKET=
3942

43+
DO_SPACES_KEY=
44+
DO_SPACES_SECRET=
45+
DO_SPACES_ENDPOINT=
46+
DO_SPACES_REGION=
47+
DO_SPACES_BUCKET=
48+
DO_URL=
49+
4050
PUSHER_APP_ID=
4151
PUSHER_APP_KEY=
4252
PUSHER_APP_SECRET=

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/node_modules
22
/public/hot
33
/public/storage
4+
/public/assets
5+
/public/mix-manifest.json
46
/storage/*.key
57
/vendor
68
.env
@@ -10,3 +12,5 @@ Homestead.json
1012
Homestead.yaml
1113
npm-debug.log
1214
yarn-error.log
15+
.idea/
16+
package-lock.json

README.md

+24-65
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,38 @@
1-
<p align="center"><img src="https://res.cloudinary.com/dtfbvvkyp/image/upload/v1566331377/laravel-logolockup-cmyk-red.svg" width="400"></p>
1+
# Laravel, Intervention Image and DigitalOcean Spaces
2+
Exercise files for the **Laravel, Intervention Image and DigitalOcean Spaces** screencast.
23

3-
<p align="center">
4-
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
5-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
6-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
7-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
8-
</p>
4+
## Set up project
95

10-
## About Laravel
6+
#### Clone repository and install composer dependencies
117

12-
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
8+
```bash
9+
git clone [email protected]:ssd-tutorials/laravel-intervention-image-do-spaces.git
1310

14-
- [Simple, fast routing engine](https://laravel.com/docs/routing).
15-
- [Powerful dependency injection container](https://laravel.com/docs/container).
16-
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
17-
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
18-
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
19-
- [Robust background job processing](https://laravel.com/docs/queues).
20-
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
11+
cd laravel-intervention-image-do-spaces
2112

22-
Laravel is accessible, powerful, and provides tools required for large, robust applications.
13+
composer install
14+
```
2315

24-
## Learning Laravel
16+
Copy .env file and generate application key
2517

26-
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
18+
```bash
19+
cp .env.example .env
2720

28-
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
21+
php artisan key:generate
22+
```
2923

30-
## Laravel Sponsors
24+
#### Create database and update .env file with credentials, then run migration with seeds
3125

32-
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
26+
```bash
27+
php artisan migrate --seed
28+
```
3329

34-
- **[Vehikl](https://vehikl.com/)**
35-
- **[Tighten Co.](https://tighten.co)**
36-
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
37-
- **[64 Robots](https://64robots.com)**
38-
- **[Cubet Techno Labs](https://cubettech.com)**
39-
- **[Cyber-Duck](https://cyber-duck.co.uk)**
40-
- **[British Software Development](https://www.britishsoftware.co)**
41-
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
42-
- **[DevSquad](https://devsquad.com)**
43-
- [UserInsights](https://userinsights.com)
44-
- [Fragrantica](https://www.fragrantica.com)
45-
- [SOFTonSOFA](https://softonsofa.com/)
46-
- [User10](https://user10.com)
47-
- [Soumettre.fr](https://soumettre.fr/)
48-
- [CodeBrisk](https://codebrisk.com)
49-
- [1Forge](https://1forge.com)
50-
- [TECPRESSO](https://tecpresso.co.jp/)
51-
- [Runtime Converter](http://runtimeconverter.com/)
52-
- [WebL'Agence](https://weblagence.com/)
53-
- [Invoice Ninja](https://www.invoiceninja.com)
54-
- [iMi digital](https://www.imi-digital.de/)
55-
- [Earthlink](https://www.earthlink.ro/)
56-
- [Steadfast Collective](https://steadfastcollective.com/)
57-
- [We Are The Robots Inc.](https://watr.mx/)
58-
- [Understand.io](https://www.understand.io/)
59-
- [Abdel Elrafa](https://abdelelrafa.com)
60-
- [Hyper Host](https://hyper.host)
61-
- [Appoly](https://www.appoly.co.uk)
62-
- [OP.GG](https://op.gg)
63-
- [云软科技](http://www.yunruan.ltd/)
30+
#### Install npm dependencies and generate assets
6431

65-
## Contributing
32+
```bash
33+
npm install
6634

67-
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
35+
npm run dev
36+
```
6837

69-
## Code of Conduct
70-
71-
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
72-
73-
## Security Vulnerabilities
74-
75-
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.
76-
77-
## License
78-
79-
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
38+
Once completed, you can open project in the browser.
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use App\Product;
6+
7+
use Illuminate\View\View;
8+
use Illuminate\Support\Collection;
9+
10+
class ProductController extends Controller
11+
{
12+
/**
13+
* Display records.
14+
*
15+
* @return \Illuminate\View\View
16+
*/
17+
public function index(): View
18+
{
19+
return view('product.index')
20+
->with('products', Product::all());
21+
}
22+
23+
/**
24+
* View record.
25+
*
26+
* @param \App\Product $product
27+
* @return \Illuminate\View\View
28+
*/
29+
public function view(Product $product): View
30+
{
31+
return view('product.product')
32+
->with('product', $product)
33+
->with('assets', new Collection);
34+
}
35+
}

app/Product.php

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
7+
/**
8+
* Class Product
9+
*
10+
* @package App
11+
*
12+
* @property int $id
13+
* @property string $name
14+
* @property \Illuminate\Support\Carbon $created_at
15+
* @property \Illuminate\Support\Carbon $updated_at
16+
*/
17+
class Product extends Model
18+
{
19+
/**
20+
* The attributes that are mass assignable.
21+
*
22+
* @var array
23+
*/
24+
protected $fillable = [
25+
'name',
26+
];
27+
}

app/Providers/AppServiceProvider.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Providers;
44

5+
use Illuminate\Support\Facades\Schema;
56
use Illuminate\Support\ServiceProvider;
67

78
class AppServiceProvider extends ServiceProvider
@@ -23,6 +24,6 @@ public function register()
2324
*/
2425
public function boot()
2526
{
26-
//
27+
Schema::defaultStringLength(191);
2728
}
2829
}

app/User.php

-39
This file was deleted.

app/helpers.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
if (!function_exists('ds')) {
4+
/**
5+
* Return directory separator or join partials with it.
6+
*
7+
* @param array $partials
8+
* @return string
9+
*/
10+
function ds(...$partials): string
11+
{
12+
if (empty($partials)) {
13+
return DIRECTORY_SEPARATOR;
14+
}
15+
16+
return DIRECTORY_SEPARATOR.ltrim(implode(DIRECTORY_SEPARATOR, $partials), DIRECTORY_SEPARATOR);
17+
}
18+
}

composer.json

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
"classmap": [
4040
"database/seeds",
4141
"database/factories"
42+
],
43+
"files": [
44+
"app/helpers.php"
4245
]
4346
},
4447
"autoload-dev": {

config/filesystems.php

+19
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@
6565
'endpoint' => env('AWS_ENDPOINT'),
6666
],
6767

68+
'spaces' => [
69+
'driver' => 's3',
70+
'key' => env('DO_SPACES_KEY'),
71+
'secret' => env('DO_SPACES_SECRET'),
72+
'region' => env('DO_SPACES_REGION'),
73+
'bucket' => env('DO_SPACES_BUCKET'),
74+
'endpoint' => env('DO_SPACES_ENDPOINT'),
75+
'url' => env('DO_URL'),
76+
],
6877
],
6978

7079
/*
@@ -82,4 +91,14 @@
8291
public_path('storage') => storage_path('app/public'),
8392
],
8493

94+
/*
95+
|--------------------------------------------------------------------------
96+
| Maximum File Size.
97+
|--------------------------------------------------------------------------
98+
|
99+
| Maximum upload file size in kb.
100+
|
101+
*/
102+
103+
'max_size' => env('MAX_FILE_SIZE', 10000),
85104
];

database/factories/ProductFactory.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
/** @var \Illuminate\Database\Eloquent\Factory $factory */
4+
5+
use App\Product;
6+
use Faker\Generator as Faker;
7+
8+
$factory->define(Product::class, function (Faker $faker) {
9+
return [
10+
'name' => ucfirst($faker->unique()->word),
11+
];
12+
});

database/factories/UserFactory.php

-28
This file was deleted.

0 commit comments

Comments
 (0)