2017 © Pedro Peláez
 

library laravel-advert

Advertising helper for laravel - based on adumskis/laravel-advert

image

ludwigheymbeeck/laravel-advert

Advertising helper for laravel - based on adumskis/laravel-advert

  • Sunday, March 26, 2017
  • by ludwigheymbeeck
  • Repository
  • 1 Watchers
  • 1 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel Advert

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., (*1)

CHANGES

changed in order to facilitate multi-to-multi ads for eyesmart by PlanetVA, (*2)

Installation

First require package with composer:, (*3)

$ composer require ludwigheymbeeck/laravel-advert dev-master

Then add service provider to config/app.php:, (*4)

'providers' => [
    ...
    Adumskis\LaravelAdvert\AdvertServiceProvider::class,
],

Facede to aliases:, (*5)

'aliases' => [
    ...
    'AdvMng'    => Adumskis\LaravelAdvert\AdvertFacade::class,
],

And last is to publish config, migrations and view:, (*6)

$ php artisan vendor:publish
$ php artisan migrate

AdvertCategory model

Simple Eloquent model with variables: - type - (string) used for getting advert in specific category - width - (int) size in pixel to resize advert - height - (int) same as width, (*7)

If width or height is set to 0 then advert image will be resized with [aspectRatio][1] method., (*8)

Eloquent model, variables: - alt - (string) alt parrameter tag - url - (string) url address where advert should redirect on click - image_url - (string) url addres of advert image - image_path - (string) path to image (from base path) - views - (int) count of views - clicks - (int) count of clicks - active - (bool) advert state - advert_category_id - (int) advert category model id - viewed_at - (timestamp) datetime of last advert view, (*9)

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:, (*10)

Advert::make(
    $request->only(['alt', 'url', 'active']), 
    $request->file('image')
);

It will return Advert object, (*11)

Usage in view

    {{ 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., (*12)

    {{ AdvMng::getHTML('type', true)

ToDo

  • Add limit to advert views/clicks

The Versions

26/03 2017

dev-master

9999999-dev

Advertising helper for laravel - based on adumskis/laravel-advert

  Sources   Download

by PlanetVA