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

type name description
string group Group name
Collection images Files collection
mixed related Related object
bool unique Should be unique

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

Get files for given group, class and id

@return \Illuminate\Support\Collection

type name description
string group Group name
string class Related class name
int id Related object id
string url Prefix URL

preview($dir, $fileID = null)

Get image preview

  • @param string $dir [Directory OR filename]
  • @param string $fileID [Optional filename if directory is set]
  • @return mixed

upload($config = [])

Handle images upload to tmp directory

  • @param array $config [Override uploader library config]
  • @return string

delete($id)

Delete image by given id

  • @param int $id [Image id]
  • @return void

handle($closure)

Register callback handler

@return void

Info

app('API')->info

setAppVersion($version)

Set App version

  • @param string $version [App version]
  • @return void

getAppVersion()

Get App version

  • @return mixed

Menu

app('API')->menu

get($flatten = false)

Get application menu tree

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

Modules

app('API')->modules

get($key = null)

Get list of modules

  • @param string $key [Get specific array key]
  • @return array

scan()

Scan for new modules

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

extend($module)

Extend module

  • @param MconsoleModule $module [Module object]
  • @return int

install($module)

Install module package migrations, assets

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

uninstall($module)

Uninstall module package

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

Notifications

app('API')->notifications

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

Push notification

  • @param string $title [Notification title]
  • @param string $text [Notification text]
  • @param string $link [Link on click]
  • @param int $user [User id]
  • @return mixed

seen($id)

Mark notification as seen

  • @param int $id [Message id]
  • @return mixed

get()

Get unread notifications

  • @return \Illuminate\Support\Collection

Options

app('API')->options

get($key)

Get option value by its key

  • @param string $key
  • @return mixed

install($options)

Create or update options

  • @param array $options [Options array]
  • @return void

uninstall($options)

Remove options from database

  • @param array $options [Options array]
  • @return void

Quick Menu

app('API')->quickmenu

register($callback)

Register callback function

  • @param Closure $callback
  • @return void

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

  • @return array

shuffle()

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

  • @return void
getText()

Get random quote text

  • @return string
getAuthor()

Get random quote author

  • @return string

Search

app('API')->search

register($callback)

Register search engine callback

  • @param Closure $callback
  • @return void

handle($text)

Handle search

  • @param string $text
  • @return \Illuminate\Support\Collection

Translations

app('API')->translations

load()

Load and merge translations

  • @return void
setUserLocale()

Set Application locale for current user settings

  • @return void

Clone this wiki locally