├── .gitignore
├── LICENSE.md
├── composer.json
├── composer.lock
├── config
└── config.php
├── migrations
├── 2016_03_11_202301_create_advert_categories_table.php
└── 2016_03_11_202607_create_adverts_table.php
├── readme.md
├── src
├── AdvertFacade.php
├── AdvertManager.php
├── AdvertManagerController.php
├── AdvertServiceProvider.php
├── Model
│ ├── Advert.php
│ └── AdvertCategory.php
└── routes.php
└── view
└── advert.blade.php
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor/
2 | /.idea/
3 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Algirdas Dumskis
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "adumskis/laravel-advert",
3 | "description": "Advertising helper for laravel",
4 | "authors": [
5 | {
6 | "name": "Algirdas",
7 | "email": "algirdasdum@gmail.com"
8 | }
9 | ],
10 | "require": {
11 | "intervention/image": "^2.3"
12 | },
13 | "autoload": {
14 | "psr-4": {
15 | "Adumskis\\LaravelAdvert\\": "src"
16 | }
17 | },
18 | "extra": {
19 | "laravel": {
20 | "providers": [
21 | "Adumskis\\LaravelAdvert\\AdvertServiceProvider"
22 | ],
23 | "aliases": {
24 | "AdvMng": "Adumskis\\LaravelAdvert\\AdvertFacade"
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 | "This file is @generated automatically"
6 | ],
7 | "content-hash": "91df4ae00e2e089f48912e5960dbbfe8",
8 | "packages": [
9 | {
10 | "name": "doctrine/inflector",
11 | "version": "dev-master",
12 | "source": {
13 | "type": "git",
14 | "url": "https://github.com/doctrine/inflector.git",
15 | "reference": "40daa067a3e5fb95572236a346a8290e4445778f"
16 | },
17 | "dist": {
18 | "type": "zip",
19 | "url": "https://api.github.com/repos/doctrine/inflector/zipball/40daa067a3e5fb95572236a346a8290e4445778f",
20 | "reference": "40daa067a3e5fb95572236a346a8290e4445778f",
21 | "shasum": ""
22 | },
23 | "require": {
24 | "php": "^7.1"
25 | },
26 | "require-dev": {
27 | "phpunit/phpunit": "^6.2"
28 | },
29 | "type": "library",
30 | "extra": {
31 | "branch-alias": {
32 | "dev-master": "1.3.x-dev"
33 | }
34 | },
35 | "autoload": {
36 | "psr-4": {
37 | "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector"
38 | }
39 | },
40 | "notification-url": "https://packagist.org/downloads/",
41 | "license": [
42 | "MIT"
43 | ],
44 | "authors": [
45 | {
46 | "name": "Roman Borschel",
47 | "email": "roman@code-factory.org"
48 | },
49 | {
50 | "name": "Benjamin Eberlei",
51 | "email": "kontakt@beberlei.de"
52 | },
53 | {
54 | "name": "Guilherme Blanco",
55 | "email": "guilhermeblanco@gmail.com"
56 | },
57 | {
58 | "name": "Jonathan Wage",
59 | "email": "jonwage@gmail.com"
60 | },
61 | {
62 | "name": "Johannes Schmitt",
63 | "email": "schmittjoh@gmail.com"
64 | }
65 | ],
66 | "description": "Common String Manipulations with regard to casing and singular/plural rules.",
67 | "homepage": "http://www.doctrine-project.org",
68 | "keywords": [
69 | "inflection",
70 | "pluralize",
71 | "singularize",
72 | "string"
73 | ],
74 | "time": "2017-10-04T05:38:52+00:00"
75 | },
76 | {
77 | "name": "guzzlehttp/psr7",
78 | "version": "dev-master",
79 | "source": {
80 | "type": "git",
81 | "url": "https://github.com/guzzle/psr7.git",
82 | "reference": "d2537c86fa8b004c29e9b9f5e10028f0a29df101"
83 | },
84 | "dist": {
85 | "type": "zip",
86 | "url": "https://api.github.com/repos/guzzle/psr7/zipball/d2537c86fa8b004c29e9b9f5e10028f0a29df101",
87 | "reference": "d2537c86fa8b004c29e9b9f5e10028f0a29df101",
88 | "shasum": ""
89 | },
90 | "require": {
91 | "php": ">=5.4.0",
92 | "psr/http-message": "~1.0"
93 | },
94 | "provide": {
95 | "psr/http-message-implementation": "1.0"
96 | },
97 | "require-dev": {
98 | "phpunit/phpunit": "~4.0"
99 | },
100 | "type": "library",
101 | "extra": {
102 | "branch-alias": {
103 | "dev-master": "1.4-dev"
104 | }
105 | },
106 | "autoload": {
107 | "psr-4": {
108 | "GuzzleHttp\\Psr7\\": "src/"
109 | },
110 | "files": [
111 | "src/functions_include.php"
112 | ]
113 | },
114 | "notification-url": "https://packagist.org/downloads/",
115 | "license": [
116 | "MIT"
117 | ],
118 | "authors": [
119 | {
120 | "name": "Michael Dowling",
121 | "email": "mtdowling@gmail.com",
122 | "homepage": "https://github.com/mtdowling"
123 | },
124 | {
125 | "name": "Tobias Schultze",
126 | "homepage": "https://github.com/Tobion"
127 | }
128 | ],
129 | "description": "PSR-7 message implementation that also provides common utility methods",
130 | "keywords": [
131 | "http",
132 | "message",
133 | "request",
134 | "response",
135 | "stream",
136 | "uri",
137 | "url"
138 | ],
139 | "time": "2017-10-07T03:19:56+00:00"
140 | },
141 | {
142 | "name": "illuminate/contracts",
143 | "version": "dev-master",
144 | "source": {
145 | "type": "git",
146 | "url": "https://github.com/illuminate/contracts.git",
147 | "reference": "ae69cd01353b505dcdb1e67f8a7c91164ca7b175"
148 | },
149 | "dist": {
150 | "type": "zip",
151 | "url": "https://api.github.com/repos/illuminate/contracts/zipball/ae69cd01353b505dcdb1e67f8a7c91164ca7b175",
152 | "reference": "ae69cd01353b505dcdb1e67f8a7c91164ca7b175",
153 | "shasum": ""
154 | },
155 | "require": {
156 | "php": ">=7.0",
157 | "psr/container": "~1.0",
158 | "psr/simple-cache": "~1.0"
159 | },
160 | "type": "library",
161 | "extra": {
162 | "branch-alias": {
163 | "dev-master": "5.6-dev"
164 | }
165 | },
166 | "autoload": {
167 | "psr-4": {
168 | "Illuminate\\Contracts\\": ""
169 | }
170 | },
171 | "notification-url": "https://packagist.org/downloads/",
172 | "license": [
173 | "MIT"
174 | ],
175 | "authors": [
176 | {
177 | "name": "Taylor Otwell",
178 | "email": "taylor@laravel.com"
179 | }
180 | ],
181 | "description": "The Illuminate Contracts package.",
182 | "homepage": "https://laravel.com",
183 | "time": "2017-10-06T13:10:32+00:00"
184 | },
185 | {
186 | "name": "illuminate/filesystem",
187 | "version": "dev-master",
188 | "source": {
189 | "type": "git",
190 | "url": "https://github.com/illuminate/filesystem.git",
191 | "reference": "d4be558fa93fc78955018b78357d61595bb9e6e3"
192 | },
193 | "dist": {
194 | "type": "zip",
195 | "url": "https://api.github.com/repos/illuminate/filesystem/zipball/d4be558fa93fc78955018b78357d61595bb9e6e3",
196 | "reference": "d4be558fa93fc78955018b78357d61595bb9e6e3",
197 | "shasum": ""
198 | },
199 | "require": {
200 | "illuminate/contracts": "5.6.*",
201 | "illuminate/support": "5.6.*",
202 | "php": ">=7.0",
203 | "symfony/finder": "~3.3"
204 | },
205 | "suggest": {
206 | "league/flysystem": "Required to use the Flysystem local and FTP drivers (~1.0).",
207 | "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).",
208 | "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0)."
209 | },
210 | "type": "library",
211 | "extra": {
212 | "branch-alias": {
213 | "dev-master": "5.6-dev"
214 | }
215 | },
216 | "autoload": {
217 | "psr-4": {
218 | "Illuminate\\Filesystem\\": ""
219 | }
220 | },
221 | "notification-url": "https://packagist.org/downloads/",
222 | "license": [
223 | "MIT"
224 | ],
225 | "authors": [
226 | {
227 | "name": "Taylor Otwell",
228 | "email": "taylor@laravel.com"
229 | }
230 | ],
231 | "description": "The Illuminate Filesystem package.",
232 | "homepage": "https://laravel.com",
233 | "time": "2017-09-13T13:37:01+00:00"
234 | },
235 | {
236 | "name": "illuminate/http",
237 | "version": "dev-master",
238 | "source": {
239 | "type": "git",
240 | "url": "https://github.com/illuminate/http.git",
241 | "reference": "f063eece27ec487d78ab8ca86f28285d6378b5b7"
242 | },
243 | "dist": {
244 | "type": "zip",
245 | "url": "https://api.github.com/repos/illuminate/http/zipball/f063eece27ec487d78ab8ca86f28285d6378b5b7",
246 | "reference": "f063eece27ec487d78ab8ca86f28285d6378b5b7",
247 | "shasum": ""
248 | },
249 | "require": {
250 | "illuminate/session": "5.6.*",
251 | "illuminate/support": "5.6.*",
252 | "php": ">=7.0",
253 | "symfony/http-foundation": "~3.3",
254 | "symfony/http-kernel": "~3.3"
255 | },
256 | "type": "library",
257 | "extra": {
258 | "branch-alias": {
259 | "dev-master": "5.6-dev"
260 | }
261 | },
262 | "autoload": {
263 | "psr-4": {
264 | "Illuminate\\Http\\": ""
265 | }
266 | },
267 | "notification-url": "https://packagist.org/downloads/",
268 | "license": [
269 | "MIT"
270 | ],
271 | "authors": [
272 | {
273 | "name": "Taylor Otwell",
274 | "email": "taylor@laravel.com"
275 | }
276 | ],
277 | "description": "The Illuminate Http package.",
278 | "homepage": "https://laravel.com",
279 | "time": "2017-10-16T12:34:44+00:00"
280 | },
281 | {
282 | "name": "illuminate/session",
283 | "version": "dev-master",
284 | "source": {
285 | "type": "git",
286 | "url": "https://github.com/illuminate/session.git",
287 | "reference": "83d2626e10df6bd04671d403a87ca5d375d4164d"
288 | },
289 | "dist": {
290 | "type": "zip",
291 | "url": "https://api.github.com/repos/illuminate/session/zipball/83d2626e10df6bd04671d403a87ca5d375d4164d",
292 | "reference": "83d2626e10df6bd04671d403a87ca5d375d4164d",
293 | "shasum": ""
294 | },
295 | "require": {
296 | "illuminate/contracts": "5.6.*",
297 | "illuminate/filesystem": "5.6.*",
298 | "illuminate/support": "5.6.*",
299 | "php": ">=7.0",
300 | "symfony/finder": "~3.3",
301 | "symfony/http-foundation": "~3.3"
302 | },
303 | "suggest": {
304 | "illuminate/console": "Required to use the session:table command (5.6.*)."
305 | },
306 | "type": "library",
307 | "extra": {
308 | "branch-alias": {
309 | "dev-master": "5.6-dev"
310 | }
311 | },
312 | "autoload": {
313 | "psr-4": {
314 | "Illuminate\\Session\\": ""
315 | }
316 | },
317 | "notification-url": "https://packagist.org/downloads/",
318 | "license": [
319 | "MIT"
320 | ],
321 | "authors": [
322 | {
323 | "name": "Taylor Otwell",
324 | "email": "taylor@laravel.com"
325 | }
326 | ],
327 | "description": "The Illuminate Session package.",
328 | "homepage": "https://laravel.com",
329 | "time": "2017-10-09T17:31:56+00:00"
330 | },
331 | {
332 | "name": "illuminate/support",
333 | "version": "dev-master",
334 | "source": {
335 | "type": "git",
336 | "url": "https://github.com/illuminate/support.git",
337 | "reference": "d0cbcd4caa0bc6d083c880a9ddd2a2cca8a916ff"
338 | },
339 | "dist": {
340 | "type": "zip",
341 | "url": "https://api.github.com/repos/illuminate/support/zipball/d0cbcd4caa0bc6d083c880a9ddd2a2cca8a916ff",
342 | "reference": "d0cbcd4caa0bc6d083c880a9ddd2a2cca8a916ff",
343 | "shasum": ""
344 | },
345 | "require": {
346 | "doctrine/inflector": "~1.1",
347 | "ext-mbstring": "*",
348 | "illuminate/contracts": "5.6.*",
349 | "nesbot/carbon": "^1.20",
350 | "php": ">=7.0"
351 | },
352 | "replace": {
353 | "tightenco/collect": "self.version"
354 | },
355 | "suggest": {
356 | "illuminate/filesystem": "Required to use the composer class (5.2.*).",
357 | "symfony/process": "Required to use the composer class (~3.3).",
358 | "symfony/var-dumper": "Required to use the dd function (~3.3)."
359 | },
360 | "type": "library",
361 | "extra": {
362 | "branch-alias": {
363 | "dev-master": "5.6-dev"
364 | }
365 | },
366 | "autoload": {
367 | "psr-4": {
368 | "Illuminate\\Support\\": ""
369 | },
370 | "files": [
371 | "helpers.php"
372 | ]
373 | },
374 | "notification-url": "https://packagist.org/downloads/",
375 | "license": [
376 | "MIT"
377 | ],
378 | "authors": [
379 | {
380 | "name": "Taylor Otwell",
381 | "email": "taylor@laravel.com"
382 | }
383 | ],
384 | "description": "The Illuminate Support package.",
385 | "homepage": "https://laravel.com",
386 | "time": "2017-10-14T09:14:11+00:00"
387 | },
388 | {
389 | "name": "intervention/image",
390 | "version": "2.4.1",
391 | "source": {
392 | "type": "git",
393 | "url": "https://github.com/Intervention/image.git",
394 | "reference": "3603dbcc9a17d307533473246a6c58c31cf17919"
395 | },
396 | "dist": {
397 | "type": "zip",
398 | "url": "https://api.github.com/repos/Intervention/image/zipball/3603dbcc9a17d307533473246a6c58c31cf17919",
399 | "reference": "3603dbcc9a17d307533473246a6c58c31cf17919",
400 | "shasum": ""
401 | },
402 | "require": {
403 | "ext-fileinfo": "*",
404 | "guzzlehttp/psr7": "~1.1",
405 | "php": ">=5.4.0"
406 | },
407 | "require-dev": {
408 | "mockery/mockery": "~0.9.2",
409 | "phpunit/phpunit": "^4.8 || ^5.7"
410 | },
411 | "suggest": {
412 | "ext-gd": "to use GD library based image processing.",
413 | "ext-imagick": "to use Imagick based image processing.",
414 | "intervention/imagecache": "Caching extension for the Intervention Image library"
415 | },
416 | "type": "library",
417 | "extra": {
418 | "branch-alias": {
419 | "dev-master": "2.3-dev"
420 | },
421 | "laravel": {
422 | "providers": [
423 | "Intervention\\Image\\ImageServiceProvider"
424 | ],
425 | "aliases": {
426 | "Image": "Intervention\\Image\\Facades\\Image"
427 | }
428 | }
429 | },
430 | "autoload": {
431 | "psr-4": {
432 | "Intervention\\Image\\": "src/Intervention/Image"
433 | }
434 | },
435 | "notification-url": "https://packagist.org/downloads/",
436 | "license": [
437 | "MIT"
438 | ],
439 | "authors": [
440 | {
441 | "name": "Oliver Vogel",
442 | "email": "oliver@olivervogel.com",
443 | "homepage": "http://olivervogel.com/"
444 | }
445 | ],
446 | "description": "Image handling and manipulation library with support for Laravel integration",
447 | "homepage": "http://image.intervention.io/",
448 | "keywords": [
449 | "gd",
450 | "image",
451 | "imagick",
452 | "laravel",
453 | "thumbnail",
454 | "watermark"
455 | ],
456 | "time": "2017-09-21T16:29:17+00:00"
457 | },
458 | {
459 | "name": "nesbot/carbon",
460 | "version": "dev-master",
461 | "source": {
462 | "type": "git",
463 | "url": "https://github.com/briannesbitt/Carbon.git",
464 | "reference": "926aee5ab38c2868816aa760f862a85ad01cb61a"
465 | },
466 | "dist": {
467 | "type": "zip",
468 | "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/926aee5ab38c2868816aa760f862a85ad01cb61a",
469 | "reference": "926aee5ab38c2868816aa760f862a85ad01cb61a",
470 | "shasum": ""
471 | },
472 | "require": {
473 | "php": ">=5.3.0",
474 | "symfony/translation": "~2.6 || ~3.0"
475 | },
476 | "require-dev": {
477 | "friendsofphp/php-cs-fixer": "~2",
478 | "phpunit/phpunit": "~4.0 || ~5.0"
479 | },
480 | "type": "library",
481 | "extra": {
482 | "branch-alias": {
483 | "dev-master": "1.23-dev"
484 | }
485 | },
486 | "autoload": {
487 | "psr-4": {
488 | "Carbon\\": "src/Carbon/"
489 | }
490 | },
491 | "notification-url": "https://packagist.org/downloads/",
492 | "license": [
493 | "MIT"
494 | ],
495 | "authors": [
496 | {
497 | "name": "Brian Nesbitt",
498 | "email": "brian@nesbot.com",
499 | "homepage": "http://nesbot.com"
500 | }
501 | ],
502 | "description": "A simple API extension for DateTime.",
503 | "homepage": "http://carbon.nesbot.com",
504 | "keywords": [
505 | "date",
506 | "datetime",
507 | "time"
508 | ],
509 | "time": "2017-02-06T22:02:47+00:00"
510 | },
511 | {
512 | "name": "paragonie/random_compat",
513 | "version": "v2.0.11",
514 | "source": {
515 | "type": "git",
516 | "url": "https://github.com/paragonie/random_compat.git",
517 | "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8"
518 | },
519 | "dist": {
520 | "type": "zip",
521 | "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8",
522 | "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8",
523 | "shasum": ""
524 | },
525 | "require": {
526 | "php": ">=5.2.0"
527 | },
528 | "require-dev": {
529 | "phpunit/phpunit": "4.*|5.*"
530 | },
531 | "suggest": {
532 | "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
533 | },
534 | "type": "library",
535 | "autoload": {
536 | "files": [
537 | "lib/random.php"
538 | ]
539 | },
540 | "notification-url": "https://packagist.org/downloads/",
541 | "license": [
542 | "MIT"
543 | ],
544 | "authors": [
545 | {
546 | "name": "Paragon Initiative Enterprises",
547 | "email": "security@paragonie.com",
548 | "homepage": "https://paragonie.com"
549 | }
550 | ],
551 | "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
552 | "keywords": [
553 | "csprng",
554 | "pseudorandom",
555 | "random"
556 | ],
557 | "time": "2017-09-27T21:40:39+00:00"
558 | },
559 | {
560 | "name": "psr/container",
561 | "version": "dev-master",
562 | "source": {
563 | "type": "git",
564 | "url": "https://github.com/php-fig/container.git",
565 | "reference": "2cc4a01788191489dc7459446ba832fa79a216a7"
566 | },
567 | "dist": {
568 | "type": "zip",
569 | "url": "https://api.github.com/repos/php-fig/container/zipball/2cc4a01788191489dc7459446ba832fa79a216a7",
570 | "reference": "2cc4a01788191489dc7459446ba832fa79a216a7",
571 | "shasum": ""
572 | },
573 | "require": {
574 | "php": ">=5.3.0"
575 | },
576 | "type": "library",
577 | "extra": {
578 | "branch-alias": {
579 | "dev-master": "1.0.x-dev"
580 | }
581 | },
582 | "autoload": {
583 | "psr-4": {
584 | "Psr\\Container\\": "src/"
585 | }
586 | },
587 | "notification-url": "https://packagist.org/downloads/",
588 | "license": [
589 | "MIT"
590 | ],
591 | "authors": [
592 | {
593 | "name": "PHP-FIG",
594 | "homepage": "http://www.php-fig.org/"
595 | }
596 | ],
597 | "description": "Common Container Interface (PHP FIG PSR-11)",
598 | "homepage": "https://github.com/php-fig/container",
599 | "keywords": [
600 | "PSR-11",
601 | "container",
602 | "container-interface",
603 | "container-interop",
604 | "psr"
605 | ],
606 | "time": "2017-06-28T15:35:32+00:00"
607 | },
608 | {
609 | "name": "psr/http-message",
610 | "version": "dev-master",
611 | "source": {
612 | "type": "git",
613 | "url": "https://github.com/php-fig/http-message.git",
614 | "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
615 | },
616 | "dist": {
617 | "type": "zip",
618 | "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
619 | "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
620 | "shasum": ""
621 | },
622 | "require": {
623 | "php": ">=5.3.0"
624 | },
625 | "type": "library",
626 | "extra": {
627 | "branch-alias": {
628 | "dev-master": "1.0.x-dev"
629 | }
630 | },
631 | "autoload": {
632 | "psr-4": {
633 | "Psr\\Http\\Message\\": "src/"
634 | }
635 | },
636 | "notification-url": "https://packagist.org/downloads/",
637 | "license": [
638 | "MIT"
639 | ],
640 | "authors": [
641 | {
642 | "name": "PHP-FIG",
643 | "homepage": "http://www.php-fig.org/"
644 | }
645 | ],
646 | "description": "Common interface for HTTP messages",
647 | "homepage": "https://github.com/php-fig/http-message",
648 | "keywords": [
649 | "http",
650 | "http-message",
651 | "psr",
652 | "psr-7",
653 | "request",
654 | "response"
655 | ],
656 | "time": "2016-08-06T14:39:51+00:00"
657 | },
658 | {
659 | "name": "psr/log",
660 | "version": "dev-master",
661 | "source": {
662 | "type": "git",
663 | "url": "https://github.com/php-fig/log.git",
664 | "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
665 | },
666 | "dist": {
667 | "type": "zip",
668 | "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
669 | "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
670 | "shasum": ""
671 | },
672 | "require": {
673 | "php": ">=5.3.0"
674 | },
675 | "type": "library",
676 | "extra": {
677 | "branch-alias": {
678 | "dev-master": "1.0.x-dev"
679 | }
680 | },
681 | "autoload": {
682 | "psr-4": {
683 | "Psr\\Log\\": "Psr/Log/"
684 | }
685 | },
686 | "notification-url": "https://packagist.org/downloads/",
687 | "license": [
688 | "MIT"
689 | ],
690 | "authors": [
691 | {
692 | "name": "PHP-FIG",
693 | "homepage": "http://www.php-fig.org/"
694 | }
695 | ],
696 | "description": "Common interface for logging libraries",
697 | "homepage": "https://github.com/php-fig/log",
698 | "keywords": [
699 | "log",
700 | "psr",
701 | "psr-3"
702 | ],
703 | "time": "2016-10-10T12:19:37+00:00"
704 | },
705 | {
706 | "name": "psr/simple-cache",
707 | "version": "dev-master",
708 | "source": {
709 | "type": "git",
710 | "url": "https://github.com/php-fig/simple-cache.git",
711 | "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24"
712 | },
713 | "dist": {
714 | "type": "zip",
715 | "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/753fa598e8f3b9966c886fe13f370baa45ef0e24",
716 | "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24",
717 | "shasum": ""
718 | },
719 | "require": {
720 | "php": ">=5.3.0"
721 | },
722 | "type": "library",
723 | "extra": {
724 | "branch-alias": {
725 | "dev-master": "1.0.x-dev"
726 | }
727 | },
728 | "autoload": {
729 | "psr-4": {
730 | "Psr\\SimpleCache\\": "src/"
731 | }
732 | },
733 | "notification-url": "https://packagist.org/downloads/",
734 | "license": [
735 | "MIT"
736 | ],
737 | "authors": [
738 | {
739 | "name": "PHP-FIG",
740 | "homepage": "http://www.php-fig.org/"
741 | }
742 | ],
743 | "description": "Common interfaces for simple caching",
744 | "keywords": [
745 | "cache",
746 | "caching",
747 | "psr",
748 | "psr-16",
749 | "simple-cache"
750 | ],
751 | "time": "2017-01-02T13:31:39+00:00"
752 | },
753 | {
754 | "name": "rymanalu/laravel-simple-uploader",
755 | "version": "v1.1.0",
756 | "source": {
757 | "type": "git",
758 | "url": "https://github.com/rymanalu/laravel-simple-uploader.git",
759 | "reference": "1a26e8d41629b023f701c22ed8f16734b77f8d77"
760 | },
761 | "dist": {
762 | "type": "zip",
763 | "url": "https://api.github.com/repos/rymanalu/laravel-simple-uploader/zipball/1a26e8d41629b023f701c22ed8f16734b77f8d77",
764 | "reference": "1a26e8d41629b023f701c22ed8f16734b77f8d77",
765 | "shasum": ""
766 | },
767 | "require": {
768 | "illuminate/contracts": "^5.0",
769 | "illuminate/http": "^5.0",
770 | "illuminate/support": "^5.0",
771 | "php": ">=5.5.9"
772 | },
773 | "require-dev": {
774 | "mockery/mockery": "~0.9",
775 | "phpunit/phpunit": "~4.8"
776 | },
777 | "type": "library",
778 | "autoload": {
779 | "psr-4": {
780 | "Rymanalu\\LaravelSimpleUploader\\": "src/"
781 | }
782 | },
783 | "notification-url": "https://packagist.org/downloads/",
784 | "license": [
785 | "MIT"
786 | ],
787 | "authors": [
788 | {
789 | "name": "Roni Yusuf Manalu",
790 | "email": "rymanalu@gmail.com"
791 | }
792 | ],
793 | "description": "Simple file uploader for Laravel 5.",
794 | "homepage": "https://github.com/rymanalu/laravel-simple-uploader",
795 | "keywords": [
796 | "laravel",
797 | "upload"
798 | ],
799 | "time": "2017-05-10T16:14:54+00:00"
800 | },
801 | {
802 | "name": "symfony/debug",
803 | "version": "3.4.x-dev",
804 | "source": {
805 | "type": "git",
806 | "url": "https://github.com/symfony/debug.git",
807 | "reference": "147025beafa520d0e0fee9dbd073636ef819f675"
808 | },
809 | "dist": {
810 | "type": "zip",
811 | "url": "https://api.github.com/repos/symfony/debug/zipball/147025beafa520d0e0fee9dbd073636ef819f675",
812 | "reference": "147025beafa520d0e0fee9dbd073636ef819f675",
813 | "shasum": ""
814 | },
815 | "require": {
816 | "php": "^5.5.9|>=7.0.8",
817 | "psr/log": "~1.0"
818 | },
819 | "conflict": {
820 | "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
821 | },
822 | "require-dev": {
823 | "symfony/http-kernel": "~2.8|~3.0|~4.0"
824 | },
825 | "type": "library",
826 | "extra": {
827 | "branch-alias": {
828 | "dev-master": "3.4-dev"
829 | }
830 | },
831 | "autoload": {
832 | "psr-4": {
833 | "Symfony\\Component\\Debug\\": ""
834 | },
835 | "exclude-from-classmap": [
836 | "/Tests/"
837 | ]
838 | },
839 | "notification-url": "https://packagist.org/downloads/",
840 | "license": [
841 | "MIT"
842 | ],
843 | "authors": [
844 | {
845 | "name": "Fabien Potencier",
846 | "email": "fabien@symfony.com"
847 | },
848 | {
849 | "name": "Symfony Community",
850 | "homepage": "https://symfony.com/contributors"
851 | }
852 | ],
853 | "description": "Symfony Debug Component",
854 | "homepage": "https://symfony.com",
855 | "time": "2017-10-10T10:38:39+00:00"
856 | },
857 | {
858 | "name": "symfony/event-dispatcher",
859 | "version": "3.4.x-dev",
860 | "source": {
861 | "type": "git",
862 | "url": "https://github.com/symfony/event-dispatcher.git",
863 | "reference": "0f8e4151b4a471df3efe1c18c95d10500dde7591"
864 | },
865 | "dist": {
866 | "type": "zip",
867 | "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/0f8e4151b4a471df3efe1c18c95d10500dde7591",
868 | "reference": "0f8e4151b4a471df3efe1c18c95d10500dde7591",
869 | "shasum": ""
870 | },
871 | "require": {
872 | "php": "^5.5.9|>=7.0.8"
873 | },
874 | "conflict": {
875 | "symfony/dependency-injection": "<3.3"
876 | },
877 | "require-dev": {
878 | "psr/log": "~1.0",
879 | "symfony/config": "~2.8|~3.0|~4.0",
880 | "symfony/dependency-injection": "~3.3|~4.0",
881 | "symfony/expression-language": "~2.8|~3.0|~4.0",
882 | "symfony/stopwatch": "~2.8|~3.0|~4.0"
883 | },
884 | "suggest": {
885 | "symfony/dependency-injection": "",
886 | "symfony/http-kernel": ""
887 | },
888 | "type": "library",
889 | "extra": {
890 | "branch-alias": {
891 | "dev-master": "3.4-dev"
892 | }
893 | },
894 | "autoload": {
895 | "psr-4": {
896 | "Symfony\\Component\\EventDispatcher\\": ""
897 | },
898 | "exclude-from-classmap": [
899 | "/Tests/"
900 | ]
901 | },
902 | "notification-url": "https://packagist.org/downloads/",
903 | "license": [
904 | "MIT"
905 | ],
906 | "authors": [
907 | {
908 | "name": "Fabien Potencier",
909 | "email": "fabien@symfony.com"
910 | },
911 | {
912 | "name": "Symfony Community",
913 | "homepage": "https://symfony.com/contributors"
914 | }
915 | ],
916 | "description": "Symfony EventDispatcher Component",
917 | "homepage": "https://symfony.com",
918 | "time": "2017-10-05T10:20:28+00:00"
919 | },
920 | {
921 | "name": "symfony/finder",
922 | "version": "3.4.x-dev",
923 | "source": {
924 | "type": "git",
925 | "url": "https://github.com/symfony/finder.git",
926 | "reference": "6db4a8ddcd86146761130989eb348451de03de74"
927 | },
928 | "dist": {
929 | "type": "zip",
930 | "url": "https://api.github.com/repos/symfony/finder/zipball/6db4a8ddcd86146761130989eb348451de03de74",
931 | "reference": "6db4a8ddcd86146761130989eb348451de03de74",
932 | "shasum": ""
933 | },
934 | "require": {
935 | "php": "^5.5.9|>=7.0.8"
936 | },
937 | "type": "library",
938 | "extra": {
939 | "branch-alias": {
940 | "dev-master": "3.4-dev"
941 | }
942 | },
943 | "autoload": {
944 | "psr-4": {
945 | "Symfony\\Component\\Finder\\": ""
946 | },
947 | "exclude-from-classmap": [
948 | "/Tests/"
949 | ]
950 | },
951 | "notification-url": "https://packagist.org/downloads/",
952 | "license": [
953 | "MIT"
954 | ],
955 | "authors": [
956 | {
957 | "name": "Fabien Potencier",
958 | "email": "fabien@symfony.com"
959 | },
960 | {
961 | "name": "Symfony Community",
962 | "homepage": "https://symfony.com/contributors"
963 | }
964 | ],
965 | "description": "Symfony Finder Component",
966 | "homepage": "https://symfony.com",
967 | "time": "2017-10-02T06:49:52+00:00"
968 | },
969 | {
970 | "name": "symfony/http-foundation",
971 | "version": "3.4.x-dev",
972 | "source": {
973 | "type": "git",
974 | "url": "https://github.com/symfony/http-foundation.git",
975 | "reference": "55ca8d885e7e0790a24ad8b2c9253bdb68035e89"
976 | },
977 | "dist": {
978 | "type": "zip",
979 | "url": "https://api.github.com/repos/symfony/http-foundation/zipball/55ca8d885e7e0790a24ad8b2c9253bdb68035e89",
980 | "reference": "55ca8d885e7e0790a24ad8b2c9253bdb68035e89",
981 | "shasum": ""
982 | },
983 | "require": {
984 | "php": "^5.5.9|>=7.0.8",
985 | "symfony/polyfill-mbstring": "~1.1",
986 | "symfony/polyfill-php70": "~1.6"
987 | },
988 | "require-dev": {
989 | "symfony/expression-language": "~2.8|~3.0|~4.0"
990 | },
991 | "type": "library",
992 | "extra": {
993 | "branch-alias": {
994 | "dev-master": "3.4-dev"
995 | }
996 | },
997 | "autoload": {
998 | "psr-4": {
999 | "Symfony\\Component\\HttpFoundation\\": ""
1000 | },
1001 | "exclude-from-classmap": [
1002 | "/Tests/"
1003 | ]
1004 | },
1005 | "notification-url": "https://packagist.org/downloads/",
1006 | "license": [
1007 | "MIT"
1008 | ],
1009 | "authors": [
1010 | {
1011 | "name": "Fabien Potencier",
1012 | "email": "fabien@symfony.com"
1013 | },
1014 | {
1015 | "name": "Symfony Community",
1016 | "homepage": "https://symfony.com/contributors"
1017 | }
1018 | ],
1019 | "description": "Symfony HttpFoundation Component",
1020 | "homepage": "https://symfony.com",
1021 | "time": "2017-10-16T22:24:46+00:00"
1022 | },
1023 | {
1024 | "name": "symfony/http-kernel",
1025 | "version": "3.4.x-dev",
1026 | "source": {
1027 | "type": "git",
1028 | "url": "https://github.com/symfony/http-kernel.git",
1029 | "reference": "3bc9f7a915989a83b43582c22ee49619f7327d32"
1030 | },
1031 | "dist": {
1032 | "type": "zip",
1033 | "url": "https://api.github.com/repos/symfony/http-kernel/zipball/3bc9f7a915989a83b43582c22ee49619f7327d32",
1034 | "reference": "3bc9f7a915989a83b43582c22ee49619f7327d32",
1035 | "shasum": ""
1036 | },
1037 | "require": {
1038 | "php": "^5.5.9|>=7.0.8",
1039 | "psr/log": "~1.0",
1040 | "symfony/debug": "~2.8|~3.0|~4.0",
1041 | "symfony/event-dispatcher": "~2.8|~3.0|~4.0",
1042 | "symfony/http-foundation": "^3.3.11|~4.0"
1043 | },
1044 | "conflict": {
1045 | "symfony/config": "<2.8",
1046 | "symfony/dependency-injection": "<3.4",
1047 | "symfony/var-dumper": "<3.3",
1048 | "twig/twig": "<1.34|<2.4,>=2"
1049 | },
1050 | "provide": {
1051 | "psr/log-implementation": "1.0"
1052 | },
1053 | "require-dev": {
1054 | "psr/cache": "~1.0",
1055 | "symfony/browser-kit": "~2.8|~3.0|~4.0",
1056 | "symfony/class-loader": "~2.8|~3.0",
1057 | "symfony/config": "~2.8|~3.0|~4.0",
1058 | "symfony/console": "~2.8|~3.0|~4.0",
1059 | "symfony/css-selector": "~2.8|~3.0|~4.0",
1060 | "symfony/dependency-injection": "~3.4|~4.0",
1061 | "symfony/dom-crawler": "~2.8|~3.0|~4.0",
1062 | "symfony/expression-language": "~2.8|~3.0|~4.0",
1063 | "symfony/finder": "~2.8|~3.0|~4.0",
1064 | "symfony/process": "~2.8|~3.0|~4.0",
1065 | "symfony/routing": "~3.4|~4.0",
1066 | "symfony/stopwatch": "~2.8|~3.0|~4.0",
1067 | "symfony/templating": "~2.8|~3.0|~4.0",
1068 | "symfony/translation": "~2.8|~3.0|~4.0",
1069 | "symfony/var-dumper": "~3.3|~4.0"
1070 | },
1071 | "suggest": {
1072 | "symfony/browser-kit": "",
1073 | "symfony/config": "",
1074 | "symfony/console": "",
1075 | "symfony/dependency-injection": "",
1076 | "symfony/finder": "",
1077 | "symfony/var-dumper": ""
1078 | },
1079 | "type": "library",
1080 | "extra": {
1081 | "branch-alias": {
1082 | "dev-master": "3.4-dev"
1083 | }
1084 | },
1085 | "autoload": {
1086 | "psr-4": {
1087 | "Symfony\\Component\\HttpKernel\\": ""
1088 | },
1089 | "exclude-from-classmap": [
1090 | "/Tests/"
1091 | ]
1092 | },
1093 | "notification-url": "https://packagist.org/downloads/",
1094 | "license": [
1095 | "MIT"
1096 | ],
1097 | "authors": [
1098 | {
1099 | "name": "Fabien Potencier",
1100 | "email": "fabien@symfony.com"
1101 | },
1102 | {
1103 | "name": "Symfony Community",
1104 | "homepage": "https://symfony.com/contributors"
1105 | }
1106 | ],
1107 | "description": "Symfony HttpKernel Component",
1108 | "homepage": "https://symfony.com",
1109 | "time": "2017-10-18T22:39:44+00:00"
1110 | },
1111 | {
1112 | "name": "symfony/polyfill-mbstring",
1113 | "version": "dev-master",
1114 | "source": {
1115 | "type": "git",
1116 | "url": "https://github.com/symfony/polyfill-mbstring.git",
1117 | "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296"
1118 | },
1119 | "dist": {
1120 | "type": "zip",
1121 | "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
1122 | "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
1123 | "shasum": ""
1124 | },
1125 | "require": {
1126 | "php": ">=5.3.3"
1127 | },
1128 | "suggest": {
1129 | "ext-mbstring": "For best performance"
1130 | },
1131 | "type": "library",
1132 | "extra": {
1133 | "branch-alias": {
1134 | "dev-master": "1.6-dev"
1135 | }
1136 | },
1137 | "autoload": {
1138 | "psr-4": {
1139 | "Symfony\\Polyfill\\Mbstring\\": ""
1140 | },
1141 | "files": [
1142 | "bootstrap.php"
1143 | ]
1144 | },
1145 | "notification-url": "https://packagist.org/downloads/",
1146 | "license": [
1147 | "MIT"
1148 | ],
1149 | "authors": [
1150 | {
1151 | "name": "Nicolas Grekas",
1152 | "email": "p@tchwork.com"
1153 | },
1154 | {
1155 | "name": "Symfony Community",
1156 | "homepage": "https://symfony.com/contributors"
1157 | }
1158 | ],
1159 | "description": "Symfony polyfill for the Mbstring extension",
1160 | "homepage": "https://symfony.com",
1161 | "keywords": [
1162 | "compatibility",
1163 | "mbstring",
1164 | "polyfill",
1165 | "portable",
1166 | "shim"
1167 | ],
1168 | "time": "2017-10-11T12:05:26+00:00"
1169 | },
1170 | {
1171 | "name": "symfony/polyfill-php70",
1172 | "version": "dev-master",
1173 | "source": {
1174 | "type": "git",
1175 | "url": "https://github.com/symfony/polyfill-php70.git",
1176 | "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff"
1177 | },
1178 | "dist": {
1179 | "type": "zip",
1180 | "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff",
1181 | "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff",
1182 | "shasum": ""
1183 | },
1184 | "require": {
1185 | "paragonie/random_compat": "~1.0|~2.0",
1186 | "php": ">=5.3.3"
1187 | },
1188 | "type": "library",
1189 | "extra": {
1190 | "branch-alias": {
1191 | "dev-master": "1.6-dev"
1192 | }
1193 | },
1194 | "autoload": {
1195 | "psr-4": {
1196 | "Symfony\\Polyfill\\Php70\\": ""
1197 | },
1198 | "files": [
1199 | "bootstrap.php"
1200 | ],
1201 | "classmap": [
1202 | "Resources/stubs"
1203 | ]
1204 | },
1205 | "notification-url": "https://packagist.org/downloads/",
1206 | "license": [
1207 | "MIT"
1208 | ],
1209 | "authors": [
1210 | {
1211 | "name": "Nicolas Grekas",
1212 | "email": "p@tchwork.com"
1213 | },
1214 | {
1215 | "name": "Symfony Community",
1216 | "homepage": "https://symfony.com/contributors"
1217 | }
1218 | ],
1219 | "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
1220 | "homepage": "https://symfony.com",
1221 | "keywords": [
1222 | "compatibility",
1223 | "polyfill",
1224 | "portable",
1225 | "shim"
1226 | ],
1227 | "time": "2017-10-11T12:05:26+00:00"
1228 | },
1229 | {
1230 | "name": "symfony/translation",
1231 | "version": "3.4.x-dev",
1232 | "source": {
1233 | "type": "git",
1234 | "url": "https://github.com/symfony/translation.git",
1235 | "reference": "24110f6b3f3fe5f9caa2a65bd3b8cba5f25be185"
1236 | },
1237 | "dist": {
1238 | "type": "zip",
1239 | "url": "https://api.github.com/repos/symfony/translation/zipball/24110f6b3f3fe5f9caa2a65bd3b8cba5f25be185",
1240 | "reference": "24110f6b3f3fe5f9caa2a65bd3b8cba5f25be185",
1241 | "shasum": ""
1242 | },
1243 | "require": {
1244 | "php": "^5.5.9|>=7.0.8",
1245 | "symfony/polyfill-mbstring": "~1.0"
1246 | },
1247 | "conflict": {
1248 | "symfony/config": "<2.8",
1249 | "symfony/dependency-injection": "<3.4",
1250 | "symfony/yaml": "<3.4"
1251 | },
1252 | "require-dev": {
1253 | "psr/log": "~1.0",
1254 | "symfony/config": "~2.8|~3.0|~4.0",
1255 | "symfony/dependency-injection": "~3.4|~4.0",
1256 | "symfony/finder": "~2.8|~3.0|~4.0",
1257 | "symfony/intl": "^2.8.18|^3.2.5|~4.0",
1258 | "symfony/yaml": "~3.4|~4.0"
1259 | },
1260 | "suggest": {
1261 | "psr/log": "To use logging capability in translator",
1262 | "symfony/config": "",
1263 | "symfony/yaml": ""
1264 | },
1265 | "type": "library",
1266 | "extra": {
1267 | "branch-alias": {
1268 | "dev-master": "3.4-dev"
1269 | }
1270 | },
1271 | "autoload": {
1272 | "psr-4": {
1273 | "Symfony\\Component\\Translation\\": ""
1274 | },
1275 | "exclude-from-classmap": [
1276 | "/Tests/"
1277 | ]
1278 | },
1279 | "notification-url": "https://packagist.org/downloads/",
1280 | "license": [
1281 | "MIT"
1282 | ],
1283 | "authors": [
1284 | {
1285 | "name": "Fabien Potencier",
1286 | "email": "fabien@symfony.com"
1287 | },
1288 | {
1289 | "name": "Symfony Community",
1290 | "homepage": "https://symfony.com/contributors"
1291 | }
1292 | ],
1293 | "description": "Symfony Translation Component",
1294 | "homepage": "https://symfony.com",
1295 | "time": "2017-10-13T13:33:47+00:00"
1296 | }
1297 | ],
1298 | "packages-dev": [],
1299 | "aliases": [],
1300 | "minimum-stability": "dev",
1301 | "stability-flags": [],
1302 | "prefer-stable": false,
1303 | "prefer-lowest": false,
1304 | "platform": [],
1305 | "platform-dev": []
1306 | }
1307 |
--------------------------------------------------------------------------------
/config/config.php:
--------------------------------------------------------------------------------
1 | 'public',
18 |
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Default Upload Path
23 | |--------------------------------------------------------------------------
24 | |
25 | | Path should not contain adv/advert/ad or anything similar to word 'advert'
26 | | because browser ad blocking software will block your ads from being viewed.
27 | |
28 | */
29 |
30 | 'upload_path' => 'uploads/a'
31 | ];
--------------------------------------------------------------------------------
/migrations/2016_03_11_202301_create_advert_categories_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('type');
18 | $table->integer('width');
19 | $table->integer('height');
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::drop('advert_categories');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/migrations/2016_03_11_202607_create_adverts_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('alt');
18 | $table->string('url');
19 | $table->string('image_url');
20 | $table->string('image_path');
21 | $table->integer('views');
22 | $table->integer('clicks');
23 | $table->boolean('active');
24 | $table->integer('advert_category_id')->unsigned();
25 | $table->timestamp('viewed_at');
26 | $table->timestamps();
27 |
28 | $table->foreign('advert_category_id')
29 | ->references('id')
30 | ->on('advert_categories')
31 | ->onDelete('cascade');
32 | });
33 | }
34 |
35 | /**
36 | * Reverse the migrations.
37 | *
38 | * @return void
39 | */
40 | public function down()
41 | {
42 | Schema::drop('adverts');
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Laravel Advert
2 | Simple package that helps add advert to Laravel 5 websites. What is more it allows to see every advert clicks and views count for some statistics.
3 |
4 | ### Installation
5 | First require package with composer:
6 | ```sh
7 | $ composer require adumskis/laravel-advert dev-master
8 | ```
9 | Then add service provider to config/app.php:
10 | > Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider
11 | ```php
12 | 'providers' => [
13 | ...
14 | Adumskis\LaravelAdvert\AdvertServiceProvider::class,
15 | ],
16 | ```
17 | Facade to aliases:
18 | ```php
19 | 'aliases' => [
20 | ...
21 | 'AdvMng' => Adumskis\LaravelAdvert\AdvertFacade::class,
22 | ],
23 | ```
24 | Publish config:
25 | ```sh
26 | $ php artisan vendor:publish --provider="Adumskis\LaravelAdvert\AdvertServiceProvider" --tag=config
27 | ```
28 |
29 | Publish Advert view:
30 | ```sh
31 | $ php artisan vendor:publish --provider="Adumskis\LaravelAdvert\AdvertServiceProvider" --tag=views
32 | ```
33 |
34 | Lastly publish the migrations if you want to edit them and migrate
35 | ```sh
36 | $ php artisan vendor:publish --provider="Adumskis\LaravelAdvert\AdvertServiceProvider" --tag=migrations
37 | $ php artisan migrate
38 | ```
39 |
40 |
41 | ### AdvertCategory model
42 | Simple Eloquent model with variables:
43 | - type - (string) used for getting advert in specific category
44 | - width - (int) size in pixel to resize advert
45 | - height - (int) same as width
46 |
47 | If width or height is set to 0 then advert image will be resized with [aspectRatio][1] method.
48 |
49 | ### Advert model
50 | Eloquent model, variables:
51 | - alt - (string)
alt parameter tag
52 | - url - (string) url address where advert should redirect on click
53 | - image_url - (string) url addres of advert image
54 | - image_path - (string) path to image (from base path)
55 | - views - (int) count of views
56 | - clicks - (int) count of clicks
57 | - active - (bool) advert state
58 | - advert_category_id - (int) advert category model id
59 | - viewed_at - (timestamp) datetime of last advert view
60 |
61 | Advert model has make method that helps to create new record in database also handles image resize and storing stuff. Method requires array with advert variables values and UploadedFile object. Simple example:
62 | ```php
63 | Advert::make(
64 | $request->only(['alt', 'url', 'active']),
65 | $request->file('image')
66 | );
67 | ```
68 |
69 | It will return Advert object
70 |
71 | ### Usage in view
72 | ```php
73 | {{ AdvMng::getHTML('type') }}
74 | ```
75 | It will take the that with lowest viewed_at parameter. getHTML method allow add second (bool) parameter and if it's true then it will not check if advert was already taken.
76 | ```php
77 | {{ AdvMng::getHTML('type', true) }}
78 | ```
79 |
80 | ### Advert image storage
81 | ```php
82 | 'default_file_system' => 'public',
83 | ```
84 | To use the inbuilt ability of laravels multiple filesystems change this to another public facing service provider such as s3.
85 |
86 |
87 | ### ToDo/Ideas
88 | - Add limit to advert views/clicks
89 | - Advert Campaigns
90 | - Advert Cost per click and cost per view?
91 | - Video Adverts.
92 | - Time of day adverts
93 | - Multiple adverts per campaign
94 | - Multiple images / videos per advert.
95 | - Follow Ad galley guide and create different size ads for different regions of the page.
96 |
97 | [aspertRatio]:http://image.intervention.io/api/resize
98 |
--------------------------------------------------------------------------------
/src/AdvertFacade.php:
--------------------------------------------------------------------------------
1 | first();
43 | if(!$advert_category){
44 | return '';
45 | }
46 |
47 | $advert = $advert_category
48 | ->adverts()
49 | ->where('active', true)
50 | ->where(function($query) use ($duplicate){
51 | if(!$duplicate){
52 | $query->whereNotIn('id', $this->used);
53 | }
54 | })
55 | ->active()
56 | ->orderBy('viewed_at', 'ASC')
57 | ->first();
58 |
59 | if($advert){
60 | $advert->plusViews();
61 | $advert->updateLastViewed();
62 | $this->used[$type][] = $advert->id;
63 | $html = View::make('partials.advert', compact('advert'))->render();
64 | return new HtmlString($html);
65 | } else {
66 | return '';
67 | }
68 | }
69 |
70 | }
--------------------------------------------------------------------------------
/src/AdvertManagerController.php:
--------------------------------------------------------------------------------
1 | plusClicks();
24 |
25 | return redirect($advert->url);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/AdvertServiceProvider.php:
--------------------------------------------------------------------------------
1 | loadRoutesFrom(__DIR__ . '/routes.php');
24 | $this->loadViewsFrom(__DIR__.'/view', 'AdvMng');
25 |
26 |
27 | // Publish a config file
28 | $this->publishes([
29 | __DIR__.'/../config/config.php' => config_path('laravel-advert.php')
30 | ], 'config');
31 |
32 | // Publish your migrations
33 | $this->publishes([
34 | __DIR__.'/../migrations/2016_03_11_202301_create_advert_categories_table.php' => database_path('migrations/2016_03_11_202301_create_advert_categories_table.php'),
35 | __DIR__.'/../migrations/2016_03_11_202607_create_adverts_table.php' => database_path('migrations/2016_03_11_202607_create_adverts_table.php')
36 | ], 'migrations');
37 |
38 | // Publishes view files
39 | $this->publishes([
40 | __DIR__.'/../view/advert.blade.php' => resource_path('views/partials/advert.blade.php')
41 | ], 'views');
42 |
43 | }
44 |
45 | /**
46 | * Register the service provider.
47 | *
48 | * @return void
49 | */
50 | public function register()
51 | {
52 | $this->app->singleton('advert_manager', function() {
53 | return new AdvertManager();
54 | });
55 | }
56 |
57 | /**
58 | * Get the services provided by the provider.
59 | *
60 | * @return array
61 | */
62 | public function provides()
63 | {
64 | return ['advert_manager'];
65 | }
66 | }
--------------------------------------------------------------------------------
/src/Model/Advert.php:
--------------------------------------------------------------------------------
1 | 'required',
43 | 'active' => 'boolean',
44 | 'advert_category_id' => 'required|exists:advert_categories,id'
45 | ]
46 | );
47 |
48 | if ($validator->fails())
49 | {
50 | throw new \Exception($validator->messages()->first());
51 | }
52 |
53 | $advert = Advert::create($data);
54 | $advert->saveImage($image);
55 |
56 | return $advert;
57 | }
58 |
59 | /**
60 | * @param $query
61 | * @return mixed
62 | */
63 | public function scopeActive($query){
64 | return $query->where('active', true);
65 | }
66 |
67 | /**
68 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
69 | */
70 | public function advert_category(){
71 | return $this->belongsTo(AdvertCategory::class);
72 | }
73 |
74 | /**
75 | * @return bool
76 | */
77 | public function activate(){
78 | return $this->update(['active' => true]);
79 | }
80 |
81 | /**
82 | * @return bool
83 | */
84 | public function deactivate(){
85 | return $this->update(['active' => false]);
86 | }
87 |
88 | /**
89 | * @return bool
90 | */
91 | public function plusViews(){
92 | return $this->update(['views' => $this->views+1]);
93 | }
94 |
95 | /**
96 | * @return bool
97 | */
98 | public function plusClicks(){
99 | return $this->update(['clicks' => $this->clicks+1]);
100 | }
101 |
102 | /**
103 | * @return bool
104 | */
105 | public function resetViews(){
106 | return $this->update(['views' => 0]);
107 | }
108 |
109 | /**
110 | * @return bool
111 | */
112 | public function resetClicks(){
113 | return $this->update(['clicks' => 0]);
114 | }
115 |
116 | /**
117 | * @return bool
118 | */
119 | public function updateLastViewed(){
120 | $this->viewed_at = Carbon::now();
121 | return $this->save();
122 | }
123 |
124 | /**
125 | * @param string $extension
126 | * @return string
127 | */
128 | public static function generateImageName($extension = 'png'){
129 | return Carbon::now()->timestamp.'_'.str_random(8).'.'.$extension;
130 | }
131 |
132 |
133 | /**
134 | * @param UploadedFile $file
135 | */
136 | public function saveImage(UploadedFile $file){
137 | $this->deleteImage();
138 | $image = Image::make($file);
139 | $image_name = Advert::generateImageName();
140 | $advert_category = $this->advert_category;
141 | $width = $advert_category->width?$advert_category->width:null;
142 | $height = $advert_category->height?$advert_category->height:null;
143 | if($advert_category->width === null || $advert_category->height === null){
144 | $image->resize($advert_category->width, $advert_category->height, function ($constraint) {
145 | $constraint->aspectRatio();
146 | });
147 | } else {
148 | $image->resize($advert_category->width, $advert_category->height);
149 | }
150 |
151 | Storage::disk(config('laravel-advert.default_file_system'))->put(config('laravel-advert.upload_path').'/'. $image_name, $image->stream()->__toString(), 'public');
152 |
153 | $this->update([
154 | 'image_url' => config('laravel-advert.upload_path').'/'.$image_name,
155 | 'image_path' => config('laravel-advert.upload_path').'/'.$image_name
156 | ]);
157 | }
158 |
159 | /**
160 | * @throws \Exception
161 | */
162 | public function delete(){
163 | $this->deleteImage();
164 | parent::delete();
165 | }
166 |
167 | /**
168 | *
169 | */
170 | private function deleteImage(){
171 | $storage = Storage::disk(config('laravel-advert.default_file_system'));
172 |
173 | if($storage->exists($this->image_path) && $this->image_path !== null){
174 | $storage->delete($this->image_path);
175 | }
176 | }
177 |
178 | /**
179 | * @return \Illuminate\Contracts\Routing\UrlGenerator|string
180 | */
181 | public function getURL(){
182 | return url('a/'.$this->id);
183 | }
184 |
185 |
186 | /**
187 | * @return \Illuminate\Contracts\Routing\UrlGenerator|string
188 | */
189 | public function getImageUrl(){
190 | return url(Storage::disk(config('laravel-advert.default_file_system'))
191 | ->url($this->image_path));
192 | }
193 | }
194 |
--------------------------------------------------------------------------------
/src/Model/AdvertCategory.php:
--------------------------------------------------------------------------------
1 | hasMany(Advert::class);
16 | }
17 |
18 | /**
19 | *
20 | */
21 | public function delete(){
22 | foreach($this->adverts as $advert){
23 | $advert->delete();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/routes.php:
--------------------------------------------------------------------------------
1 | getURL() }}" target="_blank">
2 |
3 |
4 |
--------------------------------------------------------------------------------