Skip to content
Min De Sik edited this page Mar 24, 2017 · 11 revisions

API

All API instances located in Milax\Mconsole\Core\API namespace and accessible by app('API') object.

Uploads

app('API')->uploads

attach([])

Attach uploaded files collection to given object

@return mixed

typenamedescription
stringgroupGroup name
CollectionimagesFiles collection
mixedrelatedRelated object
booluniqueShould be unique

get(string $group, string $class, int $id, string $url, $scriptURL)

Get files for given group, class and id

@return \Illuminate\Support\Collection

typenamedescription
stringgroupGroup name
stringclassRelated class name
intidRelated object id
stringurlPrefix URL

preview($dir, $fileID = null)

Get image preview

  • @paramstring$dir [Directory OR filename]
  • @paramstring$fileID [Optional filename if directory is set]
  • @returnmixed

upload($config = [])

Handle images upload to tmp directory

  • @paramarray$config [Override uploader library config]
  • @returnstring

delete($id)

Delete image by given id

  • @paramint$id [Image id]
  • @returnvoid

handle($closure)

Register callback handler

@returnvoid

Info

app('API')->info

setAppVersion($version)

Set App version

  • @paramstring$version [App version]
  • @returnvoid

getAppVersion()

Get App version

  • @returnmixed

Menu

app('API')->menu

get($flatten = false)

Get application menu tree

  • @parambool$flatten [True to flat array]
  • @return\Illuminate\Support\Collection

Modules

app('API')->modules

get($key = null)

Get list of modules

  • @paramstring$key [Get specific array key]
  • @returnarray

scan()

Scan for new modules

  • @return\Milax\Mconsole\Core\API\Modules

extend($module)

Extend module

  • @paramMconsoleModule$module [Module object]
  • @returnint

install($module)

Install module package migrations, assets

  • @paramMconsoleModule$module [Module object]
  • @return\Milax\Mconsole\Core\API\Modules

uninstall($module)

Uninstall module package

  • @paramMconsoleModule$module [ModuleObject]
  • @return\Milax\Mconsole\Core\API\Modules

Notifications

app('API')->notifications

push($title, $text, $link = null, $user = null)

Push notification

  • @paramstring$title [Notification title]
  • @paramstring$text [Notification text]
  • @paramstring$link [Link on click]
  • @paramint$user [User id]
  • @returnmixed

seen($id)

Mark notification as seen

  • @paramint$id [Message id]
  • @returnmixed

get()

Get unread notifications

  • @return\Illuminate\Support\Collection

Options

app('API')->options

get($key)

Get option value by its key

  • @paramstring$key
  • @returnmixed

install($options)

Create or update options

  • @paramarray$options [Options array]
  • @returnvoid

uninstall($options)

Remove options from database

  • @paramarray$options [Options array]
  • @returnvoid

Quick Menu

app('API')->quickmenu

register($callback)

Register callback function

  • @paramClosure$callback
  • @returnvoid

get()

Get all quick menu items

  • @return\Illumiate\Support\Collection

Quotes

app('API')->quotes

get()

Get all quotes

  • @return\Illuminate\Support\Collection

getRandom()

Get random quote

  • @returnarray

shuffle()

Shuffle quotes, set random quote in $this->random

  • @returnvoid
getText()

Get random quote text

  • @returnstring
getAuthor()

Get random quote author

  • @returnstring

Search

app('API')->search

register($callback)

Register search engine callback

  • @paramClosure$callback
  • @returnvoid

handle($text)

Handle search

  • @paramstring$text
  • @return\Illuminate\Support\Collection

Translations

app('API')->translations

load()

Load and merge translations

  • @returnvoid
setUserLocale()

Set Application locale for current user settings

  • @returnvoid

Clone this wiki locally