承接 adumskis/laravel-advert 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

adumskis/laravel-advert

Composer 安装命令:

composer require adumskis/laravel-advert

包简介

Advertising helper for laravel

README 文档

README

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.

Installation

First require package with composer:

$ composer require adumskis/laravel-advert dev-master

Then add service provider to config/app.php:

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider

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

Facade to aliases:

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

Publish config:

$ php artisan vendor:publish --provider="Adumskis\LaravelAdvert\AdvertServiceProvider" --tag=config

Publish Advert view:

$ php artisan vendor:publish --provider="Adumskis\LaravelAdvert\AdvertServiceProvider" --tag=views

Lastly publish the migrations if you want to edit them and migrate

$ php artisan vendor:publish --provider="Adumskis\LaravelAdvert\AdvertServiceProvider" --tag=migrations
$ 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

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

Advert model

Eloquent model, variables:

  • alt - (string) alt parameter 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

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

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.

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

Advert image storage

    'default_file_system' => 'public',

To use the inbuilt ability of laravels multiple filesystems change this to another public facing service provider such as s3.

ToDo/Ideas

  • Add limit to advert views/clicks
  • Advert Campaigns
  • Advert Cost per click and cost per view?
  • Video Adverts.
  • Time of day adverts
  • Multiple adverts per campaign
  • Multiple images / videos per advert.
  • Follow Ad galley guide and create different size ads for different regions of the page.

统计信息

  • 总下载量: 17.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 48
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 48
  • Watchers: 8
  • Forks: 24
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-03-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固