Package Data | |
---|---|
Maintainer Username: | ludwigheymbeeck |
Maintainer Contact: | info@planetva.com (PlanetVA) |
Package Create Date: | 2017-03-16 |
Package Last Update: | 2017-03-26 |
Home Page: | |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2025-02-12 15:10:29 |
Package Statistics | |
---|---|
Total Downloads: | 49 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
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.
changed in order to facilitate multi-to-multi ads for eyesmart by PlanetVA
First require package with composer:
$ composer require ludwigheymbeeck/laravel-advert dev-master
Then add service provider to config/app.php:
'providers' => [
...
Adumskis\LaravelAdvert\AdvertServiceProvider::class,
],
Facede to aliases:
'aliases' => [
...
'AdvMng' => Adumskis\LaravelAdvert\AdvertFacade::class,
],
And last is to publish config, migrations and view:
$ php artisan vendor:publish
$ php artisan migrate
Simple Eloquent model with variables:
If width or height is set to 0 then advert image will be resized with [aspectRatio][1] method.
Eloquent model, variables:
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:
Advert::make(
$request->only(['alt', 'url', 'active']),
$request->file('image')
);
It will return Advert object
{{ AdvMng::getHTML('type')
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.
{{ AdvMng::getHTML('type', true)