本文整理汇总了PHP中Api::Enabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::Enabled方法的具体用法?PHP Api::Enabled怎么用?PHP Api::Enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::Enabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get()
{
if (Api::Enabled()) {
return Api::make($this->comment->all()->get()->toArray());
} else {
return Datatables::of($this->comment->all())->edit_column('content', '<a href="{{{ URL::to(\'admin/comments/\'. $id .\'/edit\') }}}" class="modalfy cboxElement">{{{ Str::limit($content, 40, \'...\') }}}</a>')->edit_column('post_name', '<a href="{{{ URL::to(\'admin/slugs/\'. $postid .\'/edit\') }}}" class="modalfy cboxElement">{{{ Str::limit($post_name, 40, \'...\') }}}</a>')->edit_column('poster_name', '<a href="{{{ URL::to(\'admin/users/\'. $userid .\'/edit\') }}}" class="modalfy cboxElement">{{{ $poster_name }}}</a>')->add_column('actions', '<div class="btn-group"><a href="{{{ URL::to(\'admin/comments/\' . $id . \'/edit\' ) }}}" class="modalfy btn btn-primary btn-sm"><span class="glyphicon glyphicon-pencil"></span></a> <a data-row="{{{ $id }}}" data-method="delete" data-table="comments" href="{{{ URL::to(\'admin/comments/\' . $id . \'\' ) }}}" class="confirm-ajax-update btn btn-sm btn-danger"><span class="glyphicon glyphicon-remove"></span></a></div>')->remove_column('postid')->remove_column('userid')->make();
}
}
示例2: get
public function get()
{
if (Api::Enabled()) {
return Api::make($this->role->all()->get()->toArray());
} else {
return Datatables::of($this->role->all())->edit_column('users', '{{{ DB::table(\'assigned_roles\')->where(\'role_id\', \'=\', $id)->count() }}}')->add_column('actions', '<div class="btn-group"><a href="{{{ URL::to(\'admin/roles/\' . $id . \'/edit\' ) }}}" class="modalfy btn btn-sm btn-primary"><span class="glyphicon glyphicon-pencil"></span></a>
<a data-row="{{{ $id }}}" data-method="delete" data-table="roles" href="{{{ URL::to(\'admin/roles/\' . $id . \'\' ) }}}" class="confirm-ajax-update btn btn-sm btn-danger" @if($name == "admin" || $name == "users")disabled@endif><span class="glyphicon glyphicon-remove"></span></a></div>
')->make();
}
}
示例3: get
public function get()
{
if (Api::Enabled()) {
return Api::make($this->post->all()->get()->toArray());
} else {
return Datatables::of($this->post->all())->edit_column('comments', '{{ DB::table(\'comments\')->where(\'post_id\', \'=\', $id)->count() }}')->add_column('actions', '<div class="btn-group"><a href="{{{ URL::to(\'admin/slugs/\' . $id . \'/edit\' ) }}}" class="btn btn-primary btn-sm modalfy" ><span class="glyphicon glyphicon-pencil"></span></a>
<a data-method="delete" data-row="{{{ $id }}}" data-table="blogs" href="{{{ URL::to(\'admin/slugs/\' . $id . \'\' ) }}}" class="confirm-ajax-update btn btn-sm btn-danger"><span class="glyphicon glyphicon-remove"></span></a></div>
')->make();
}
}
示例4: getData
/**
* Show a list of all the comments formatted for Datatables.
*
* @return Datatables JSON
*/
public function getData()
{
$comments = Comment::leftjoin('posts', 'posts.id', '=', 'comments.post_id')->leftjoin('users', 'users.id', '=', 'comments.user_id')->select(array('comments.id as id', 'posts.id as postid', 'users.id as userid', 'comments.content', 'posts.title as post_name', 'users.displayname as poster_name', 'comments.created_at'));
if (Api::Enabled()) {
$u = $comments->get();
return Api::make($u->toArray());
} else {
return Datatables::of($comments)->edit_column('content', '<a href="{{{ URL::to(\'admin/comments/\'. $id .\'/edit\') }}}" class="modalfy cboxElement">{{{ Str::limit($content, 40, \'...\') }}}</a>')->edit_column('post_name', '<a href="{{{ URL::to(\'admin/slugs/\'. $postid .\'/edit\') }}}" class="modalfy cboxElement">{{{ Str::limit($post_name, 40, \'...\') }}}</a>')->edit_column('poster_name', '<a href="{{{ URL::to(\'admin/users/\'. $userid .\'/edit\') }}}" class="modalfy cboxElement">{{{ $poster_name }}}</a>')->add_column('actions', '<div class="btn-group"><a href="{{{ URL::to(\'admin/comments/\' . $id . \'/edit\' ) }}}" class="modalfy btn btn-primary btn-sm">{{{ Lang::get(\'button.edit\') }}}</a>
<a data-row="{{{ $id }}}" data-method="delete" data-table="comments" href="{{{ URL::to(\'admin/comments/\' . $id . \'\' ) }}}" class="ajax-alert-confirm btn btn-sm btn-danger">{{{ Lang::get(\'button.delete\') }}}</a></div>
')->remove_column('postid')->remove_column('userid')->make();
}
}
示例5: emails
public function emails($user)
{
if ($user->id) {
$list = $user->emails();
if (Api::Enabled()) {
$u = $list->get();
return Api::make($u->toArray());
} else {
return Datatables::of($list)->edit_column('updated_at', '{{{ Carbon::parse($updated_at)->diffForHumans() }}}')->edit_column('details', '{{{ strip_tags(substr($details,0,100))}}}')->make();
}
}
}
示例6: get
public function get()
{
if (Api::Enabled()) {
return Api::make($this->todo->all()->get()->toArray());
} else {
return Datatables::of($this->todo->all())->edit_column('status', '{{{ Lang::get(\'admin/todos/todos.status_\'.$status) }}}')->edit_column('due_at', '{{{ Carbon::parse($due_at)->diffForHumans() }}}')->edit_column('created_at', '{{{ Carbon::parse($created_at)->diffForHumans() }}}')->edit_column('displayname', '{{{ $displayname ? : "Nobody" }}}')->add_column('actions', '<div class="btn-group" style="width: 200px">
<a href="{{{ URL::to(\'admin/todos/\' . $id . \'/edit\' ) }}}" class="modalfy btn btn-sm btn-primary"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="{{{ URL::to(\'admin/todos/\' . $id . \'/assign\' ) }}}" data-row="{{{ $id }}}" data-table="todos" class="confirm-ajax-update btn btn-sm btn-default">{{{ Lang::get(\'button.assign_to_me\') }}}</a>
<a data-row="{{{ $id }}}" data-table="todos" data-method="delete" href="{{{ URL::to(\'admin/todos/\' . $id . \'\' ) }}}" class="confirm-ajax-update btn btn-sm btn-danger"><span class="glyphicon glyphicon-remove"></span></a>
</div>
')->make();
}
}
示例7: get
public function get()
{
if (Api::Enabled()) {
return Api::make($this->comment->all()->get()->toArray());
} else {
return Datatables::of($this->comment->all())->edit_column('content', '<a href="{{{ URL::to(\'admin/comments/\'. $id .\'/edit\') }}}" class="modalfy cboxElement">{{{ Str::limit($content, 40, \'...\') }}}</a>')->edit_column('post_name', '<a href="{{{ URL::to(\'admin/slugs/\'. $postid .\'/edit\') }}}" class="modalfy cboxElement">{{{ Str::limit($post_name, 40, \'...\') }}}</a>')->edit_column('poster_name', '<a href="{{{ URL::to(\'admin/users/\'. $userid .\'/edit\') }}}" class="modalfy cboxElement">{{{ $poster_name }}}</a>')->add_column('actions', '
<div class="btn-group btn-hover">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="fa fa-lg fa-cog fa-fw"></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="{{{ URL::to(\'admin/comments/\' . $id . \'/edit\' ) }}}" class="modalfy ">{{{ Lang::get(\'button.edit\') }}}</a></li>
<li class="divider"></li>
<li><a data-row="{{{ $id }}}" data-method="delete" data-table="comments" href="{{{ URL::to(\'admin/comments/\' . $id . \'\' ) }}}" class="confirm-ajax-update ">{{{ Lang::get(\'button.delete\') }}}</a></li>
</ul>
</div>
')->remove_column('postid')->remove_column('userid')->make();
}
}
示例8: get
public function get()
{
if (Api::Enabled()) {
return Api::make($this->post->all()->get()->toArray());
} else {
return Datatables::of($this->post->all())->edit_column('title', '<a href="{{{ URL::to(\'admin/slugs/\' . $id . \'/edit\' ) }}}" class="modalfy">{{{$title}}}</a>')->edit_column('comments', '{{ DB::table(\'comments\')->where(\'post_id\', \'=\', $id)->count() }}')->add_column('actions', '
<div class="btn-group btn-hover">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="fa fa-lg fa-cog fa-fw"></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="{{{ URL::to(\'admin/slugs/\' . $id . \'/edit\' ) }}}" class="modalfy" >{{{ Lang::get(\'button.edit\') }}}</a></li>
<li class="divider"></li>
<li><a data-method="delete" data-row="{{{ $id }}}" data-table="blogs" href="{{{ URL::to(\'admin/slugs/\' . $id . \'\' ) }}}" class="confirm-ajax-update ">{{{ Lang::get(\'button.delete\') }}}</a></li>
</ul>
</div>
')->make();
}
}
示例9: get
public function get()
{
if (Api::Enabled()) {
return Api::make($this->todo->all()->get()->toArray());
} else {
return Datatables::of($this->todo->all())->edit_column('title', '<a href="{{{ URL::to(\'admin/todos/\' . $id . \'/edit\' ) }}}" class="modalfy">{{{ Str::limit($title, 40, \'...\') }}}</a>')->edit_column('description', '<a href="{{{ URL::to(\'admin/todos/\' . $id . \'/edit\' ) }}}" class="modalfy">{{{ Str::limit($description, 40, \'...\') }}}</a>')->edit_column('status', '<a href="{{{ URL::to(\'admin/todos/\' . $id . \'/edit\' ) }}}" class="modalfy">{{{ Lang::get(\'admin/todos/todos.status_\'.$status) }}}</a>')->edit_column('due_at', '{{{ Carbon::parse($due_at)->diffForHumans() }}}')->edit_column('created_at', '{{{ Carbon::parse($created_at)->diffForHumans() }}}')->edit_column('displayname', '{{{ $displayname ? : "Nobody" }}}')->add_column('actions', '
<div class="btn-group btn-hover">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="fa fa-lg fa-cog fa-fw"></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="{{{ URL::to(\'admin/todos/\' . $id . \'/edit\' ) }}}" class="modalfy ">{{{ Lang::get(\'button.edit\') }}}</a></li>
<li class="divider"></li>
<li><a href="{{{ URL::to(\'admin/todos/\' . $id . \'/assign\' ) }}}" data-row="{{{ $id }}}" data-table="todos" class="confirm-ajax-update ">{{{ Lang::get(\'button.assign_to_me\') }}}</a></li>
<li class="divider"></li>
<li><a data-row="{{{ $id }}}" data-table="todos" data-method="delete" href="{{{ URL::to(\'admin/todos/\' . $id . \'\' ) }}}" class="confirm-ajax-update">{{{ Lang::get(\'button.delete\') }}}</a></li>
</ul>
</div>
')->make();
}
}
示例10: get
public function get()
{
if (Api::Enabled()) {
return Api::make($this->role->all()->get()->toArray());
} else {
return Datatables::of($this->role->all())->edit_column('name', '<a href="{{{ URL::to(\'admin/roles/\' . $id . \'/edit\' ) }}}" class="modalfy">{{{$name}}}</a>')->edit_column('users', '{{{ DB::table(\'assigned_roles\')->where(\'role_id\', \'=\', $id)->count() }}}')->add_column('actions', '
<div class="btn-group btn-hover">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="fa fa-lg fa-cog fa-fw"></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="{{{ URL::to(\'admin/roles/\' . $id . \'/edit\' ) }}}" class="modalfy">{{{ Lang::get(\'button.edit\') }}}</a></li>
<li class="divider"></li>
@if(in_array($name, Role::$protected) || $id == Setting::get("users.default_role_id"))
<li><a href="#disabled" class="disabled">{{{ Lang::get(\'button.delete\') }}}</a></li>
@else
<li><a data-row="{{{ $id }}}" data-method="delete" data-table="roles" href="{{{ URL::to(\'admin/roles/\' . $id . \'\' ) }}}" class="confirm-ajax-update">{{{ Lang::get(\'button.delete\') }}}</a></li>
@endif
</ul>
</div>
')->make();
}
}
示例11: getData
/**
* Show a list of all the blog posts formatted for Datatables.
*
* @return Datatables JSON
*/
public function getData()
{
$list = TicketStatuses::select(array('id', 'title', 'auto_close', 'color'))->orderBy('sort');
if (Api::Enabled()) {
$u = $list->get();
return Api::make($u->toArray());
} else {
return Datatables::of($list)->edit_column('auto_close', '{{{ $auto_close ? "Yes" : "No" }}} ')->edit_column('title', '@if($color)<span style="color: {{{ $color }}}">{{{ $title }}}</span>@else{{{ $title }}}@endif')->add_column('actions', '<div class="btn-group"><a href="{{{ URL::to(\'admin/support/statuses/\' . $id . \'/edit\' ) }}}" class="btn btn-primary btn-sm modalfy" >{{{ Lang::get(\'button.edit\') }}}</a>
<a data-method="delete" data-row="{{{ $id }}}" data-table="statuses" href="{{{ URL::to(\'admin/support/statuses/\' . $id . \'\' ) }}}" class="confirm-ajax-update btn btn-sm btn-danger">{{{ Lang::get(\'button.delete\') }}}</a></div>
')->remove_column('color')->make();
}
}
示例12: getData
/**
* Show a list of all the blog posts formatted for Datatables.
*
* @return Datatables JSON
*/
public function getData()
{
$list = TicketDeps::select(array('id', 'name', 'description'))->orderBy('sort');
if (Api::Enabled()) {
$u = $list->get();
return Api::make($u->toArray());
} else {
return Datatables::of($list)->edit_column('description', '{{{ Filter::filter(Str::limit(strip_tags($description), 100, "..."), "*") }}} ')->add_column('actions', '<div class="btn-group"><a href="{{{ URL::to(\'admin/support/departments/\' . $id . \'/edit\' ) }}}" class="btn btn-primary btn-sm modalfy" >{{{ Lang::get(\'button.edit\') }}}</a>
<a data-method="delete" data-row="{{{ $id }}}" data-table="departments" href="{{{ URL::to(\'admin/support/departments/\' . $id . \'\' ) }}}" class="confirm-ajax-update btn btn-sm btn-danger">{{{ Lang::get(\'button.delete\') }}}</a></div>
')->make();
}
}
示例13: getData
/**
* Show a list of all the users formatted for Datatables.
*
* @return Datatables JSON
*/
public function getData()
{
$users = User::leftjoin('assigned_roles', 'assigned_roles.user_id', '=', 'users.id')->leftjoin('roles', 'roles.id', '=', 'assigned_roles.role_id')->select(DB::raw('users.id, users.displayname,users.email, group_concat(roles.name SEPARATOR \', \') as rolename'))->groupBy(DB::raw('users.id , users.displayname , users.email'));
if (Api::Enabled()) {
$u = $users->get();
return Api::make($u->toArray());
} else {
return Datatables::of($users)->add_column('actions', '<div class="btn-group">
<a href="{{{ URL::to(\'admin/users/\' . $id . \'/edit\' ) }}}" class="modalfy btn btn-sm btn-primary">{{{ Lang::get(\'button.edit\') }}}</a>
<a href="{{{ URL::to(\'admin/users/\' . $id . \'/email\' ) }}}" class="modalfy btn btn-sm btn-default">{{{ Lang::get(\'button.email\') }}}</a>
@if($id == Auth::user()->id)
<a href="#" class="disabled btn btn-sm btn-danger">{{{ Lang::get(\'button.delete\') }}}</a>
@else
<a data-row="{{{ $id }}}" data-table="users" data-method="delete" href="{{{ URL::to(\'admin/users/\' . $id . \'\' ) }}}" class="ajax-alert-confirm btn btn-sm btn-danger">{{{ Lang::get(\'button.delete\') }}}</a>
@endif</div>
')->make();
}
}
示例14: getData
/**
* Show a list of all the blog posts formatted for Datatables.
*
* @return Datatables JSON
*/
public function getData($slug = false)
{
if ($slug) {
$department = Support::getStatusByName($slug);
if ($department->default_flag) {
$list = Ticket::select(array('ticket.id', 'priority', 'users.displayname', 'ticket.title', 'ticket_deps.name', 'ticket_statuses.title as status', 'ticket.updated_at', 'ticket_statuses.color as color'))->leftjoin('ticket_flags', 'ticket_flags.ticket_id', '=', 'ticket.id')->where('ticket_flags.user_id', '=', Confide::user()->id)->leftjoin('ticket_statuses', 'ticket_statuses.id', '=', 'ticket.status');
} else {
$list = Ticket::select(array('ticket.id', 'priority', 'users.displayname', 'ticket.title', 'ticket_deps.name', 'ticket.updated_at'))->where('status', '=', $department->id);
}
} else {
$list = Ticket::select(array('ticket.id', 'priority', 'users.displayname', 'ticket.title', 'ticket_deps.name', 'ticket_statuses.title as status', 'ticket.updated_at', 'ticket_statuses.color as color'))->leftjoin('ticket_statuses', 'ticket_statuses.id', '=', 'ticket.status')->where('ticket_statuses.show_active', '=', '1');
}
//->leftjoin('ticket_flags', 'ticket_flags.ticket_id', '=', 'ticket.id')->where(DB::raw('ticket_flags.user_id = '. Confide::user()->id. ' OR ticket_flags.user_id = ""'));
$list->leftjoin('users', 'users.id', '=', 'ticket.user_id')->leftjoin('ticket_deps', 'ticket_deps.id', '=', 'ticket.department_id');
if (Api::Enabled()) {
$u = $list->get();
return Api::make($u->toArray());
} else {
return Datatables::of($list)->remove_column('color')->edit_column('displayname', '<a href="{{{ URL::to(\'admin/support/\' . $id . \'/thread\' ) }}}">{{{ $displayname }}}')->edit_column('updated_at', '{{{ Carbon::parse($updated_at)->diffForHumans() }}}')->edit_column('priority', '{{ $priority > 0 ? "<span class=\\"fa fa-flag". ($priority > 1 ? ($priority == 3 ? "-checkered" : "-o") : null) ." \\"></span>" : null}}')->edit_column('title', '<a href="{{{ URL::to(\'admin/support/\' . $id . \'/thread\' ) }}}">{{{ Filter::filter(Str::limit(strip_tags($title), 42, "..."), "*") }}}</a>')->edit_column('status', '@if(isset($status))@if(isset($color))<span style="color: {{{ $color }}}">{{{ $status }}}</span>@else{{{ $status }}}@endif@endif')->add_column('actions', '<div class="btn-group"><a href="{{{ URL::to(\'admin/support/\' . $id . \'/thread\' ) }}}" class="link-through btn btn-info btn-sm" >{{{ Lang::get(\'button.view\') }}}</a><a href="{{{ URL::to(\'admin/support/\' . $id . \'/edit\' ) }}}" class="btn btn-primary btn-sm modalfy" >{{{ Lang::get(\'button.edit\') }}}</a>
<a data-method="delete" data-row="{{{ $id }}}" data-table="tickets" href="{{{ URL::to(\'admin/support/\' . $id . \'\' ) }}}" class="confirm-ajax-update btn btn-sm btn-danger">{{{ Lang::get(\'button.delete\') }}}</a></div>
')->make();
}
}
示例15: getData
/**
* get data
*
* @return Response
*/
public function getData()
{
$list = Todos::leftjoin('users', 'users.id', '=', 'todos.admin_id')->select(array('todos.id', 'todos.title', 'todos.status', 'todos.description', 'todos.created_at', 'todos.due_at', 'users.displayname'));
if (Api::Enabled()) {
$u = $list->get();
return Api::make($u->toArray());
} else {
return Datatables::of($list)->edit_column('status', '{{{ Lang::get(\'admin/todos/todos.status_\'.$status) }}}')->edit_column('due_at', '{{{ Carbon::parse($due_at)->diffForHumans() }}}')->edit_column('created_at', '{{{ Carbon::parse($created_at)->diffForHumans() }}}')->edit_column('displayname', '{{{ $displayname ? : "Nobody" }}}')->add_column('actions', '<div class="btn-group" style="width: 200px">
<a href="{{{ URL::to(\'admin/todos/\' . $id . \'/edit\' ) }}}" class="modalfy btn btn-sm btn-primary">{{{ Lang::get(\'button.edit\') }}}</a>
<a href="{{{ URL::to(\'admin/todos/\' . $id . \'/assign\' ) }}}" data-row="{{{ $id }}}" data-table="todos" class="ajax-alert-confirm btn btn-sm btn-default">{{{ Lang::get(\'button.assign_to_me\') }}}</a>
<a data-row="{{{ $id }}}" data-table="todos" data-method="delete" href="{{{ URL::to(\'admin/todos/\' . $id . \'\' ) }}}" class="ajax-alert-confirm btn btn-sm btn-danger">{{{ Lang::get(\'button.delete\') }}}</a>
</div>
')->make();
}
}