コード例 #1
0
ファイル: departments.php プロジェクト: pepfi/anchor-cms
<?php

Route::collection(array('before' => 'auth,csrf'), function () {
    Route::get(array('admin/departments', 'admin/departments/(:num)'), function ($page = 1) {
        $vars['messages'] = Notify::read();
        $vars['departments'] = Department::paginate($page, Config::get('meta.posts_per_page'));
        return View::create('departments/index', $vars)->partial('header', 'partials/header')->partial('footer', 'partials/footer');
    });
    Route::get('admin/departments/edit/(:num)', function ($id) {
        $vars['messages'] = Notify::read();
        $vars['token'] = Csrf::token();
        $vars['department'] = Department::find($id);
        $vars['fields'] = Extend::fields('department', $id);
        return View::create('departments/edit', $vars)->partial('header', 'partials/header')->partial('footer', 'partials/footer');
    });
    Route::post('admin/departments/edit/(:num)', function ($id) {
        $input = Input::get(array('title', 'slug', 'description'));
        $validator = new validator($input);
        $validator->check('title')->is_max(3, __('departments.title_missing'));
        if ($errors = $validator->errors()) {
            Input::flash();
            Notify::error($errors);
            return Response::redirect('admin/departments/edit/' . $id);
        }
        if (empty($input['slug'])) {
            $input['slug'] = $input['title'];
        }
        $input['slug'] = slug($input['slug']);
        department::update($id, $input);
        Extend::process('department', $id);
        Notify::successs(__('departments.update'));
コード例 #2
0
@extends('layouts.admin.default')

@section('content')

<?php 
$departmentCount = Department::count();
$departments = Department::paginate(10);
$message = Session::get('message');
?>

<div class="page-container">

        <div class="row" style="padding-bottom:20px;">

          <div class="col-md-2 clearfix">

            <aside class="sidebar">
              <nav class="sidebar-nav">
                <ul id="menu">
                  <li>
                    <a href="{{ url('/admin/dashboard') }}">
                      <span class="sidebar-nav-item-icon fa fa-tachometer fa-lg"></span>                      
                      <span class="sidebar-nav-item">Dashboard</span>                      
                    </a>
                    
                  </li>
                  <li>
                    <a href="#">
                      <span class="sidebar-nav-item-icon fa fa-users fa-lg"></span>                      
                      <span class="sidebar-nav-item">Employees</span>                      
                    </a>
コード例 #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $department = \Department::paginate(20);
     return \View::make('admin/department.manage')->with('depart', $department);
 }