예제 #1
0
/**
 * Recursive function to output the html we need
 * @param $comments
 * @param $post
 */
function displayComments($comments, $post)
{
    foreach ($comments as $comment) {
        echo '<div class="well">';
        echo '<div>';
        echo $comment->text . '-' . $comment->user->name . '</div>';
        echo '<div>';
        if (Auth::check()) {
            if (Auth::user()->admin) {
                echo "<form action='/comment/" . $comment->id . "/delete' method='POST'>";
                echo csrf_field();
                echo method_field('DELETE');
                echo "<button type='submit' id='delete-comment-" . $comment->id . "' class='btn btn-danger btn-xs'>";
                echo "<i class='fa fa-btn fa-trash'></i> Delete Comment";
                echo "</button>";
                echo "</form>";
                echo "<br>";
            }
            echo '<button id="/comment/' . $post->id . '/' . $comment->id . '" class="btn btn-primary btn-xs"><i class="fa fa-reply"></i> Reply</button> ';
            echo '<button id="/commend/' . $comment->id . '" class="btn btn-success btn-xs"><i class="fa fa-thumbs-up"></i> Commend (' . $comment->voteCount . ')</button> ';
            if (Auth::user()->admin) {
                echo "<a href=" . route('confirmBan', ['userId' => $comment->user->id]) . " class='btn btn-danger btn-xs'><i class='fa fa-ban'></i> Ban User</a> ";
            }
        }
        if ($comment->replies) {
            displayComments($comment->replies, $post);
        }
        echo '</div>';
        echo '</div>';
    }
}
예제 #2
0
 function form(Form\Form\Form $form)
 {
     $html = '';
     $form->addAttribute('role', 'form');
     $form->addClass('form-horizontal');
     // Elements
     if ($form->hasCsrfToken()) {
         $html .= csrf_field();
     }
     if ($form->hasLegend()) {
         $html .= html('h4', ['class' => Style::MODAL_HEADER_TITLE_CLASS], $form->getLegend());
     }
     $html = html('div', ['class' => Style::MODAL_HEADER_CLASS], $html);
     $body = '';
     foreach ($form->getElements() as $e) {
         /** @var $e \FrenchFrogs\Form\Element\Element */
         $body .= $e->render();
     }
     // body
     $html .= html('div', ['class' => Style::MODAL_BODY_CLASS . ' form-body'], $body);
     // Actions
     if ($form->hasActions()) {
         $actions = '';
         foreach ($form->getActions() as $e) {
             $actions .= $e->render();
         }
         $html .= html('div', ['class' => Style::MODAL_FOOTER_CLASS], $actions);
     }
     if ($form->isRemote()) {
         $form->addClass('form-remote');
     }
     $html = html('form', $form->getAttributes(), $html);
     return $html;
 }
예제 #3
0
 function form(Form\Form\Form $form)
 {
     $html = '';
     $form->addAttribute('role', 'form');
     // Elements
     if ($form->hasCsrfToken()) {
         $html .= csrf_field();
     }
     foreach ($form->getElements() as $e) {
         /** @var $e \FrenchFrogs\Form\Element\Element */
         $html .= $e->render();
     }
     // Actions
     if ($form->hasActions()) {
         $html .= '<div class="text-right">';
         foreach ($form->getActions() as $e) {
             $html .= $e->render();
         }
         $html .= "</div>";
     }
     if ($form->isRemote()) {
         $form->addClass('form-remote');
     } elseif ($form->isCallback()) {
         $form->addClass('form-callback');
     }
     $form->addCLass('form-horizontal');
     $html = html('form', $form->getAttributes(), $html);
     if ($form->hasPanel()) {
         $html = $form->getPanel()->setBody($html)->render();
     }
     return $html;
 }
예제 #4
0
 /**
  * Responds to requests to GET /books/create
  */
 public function getCreate()
 {
     $view = '<form method = "POST" action="/books/create">';
     $view .= csrf_field();
     $view .= '<input type="text" name="title">';
     $view .= '<input type="submit">';
     $view .= '</form>';
     return $view;
 }
예제 #5
0
function link_to_act($action, $type, $body, $button_class = 'btn btn-primary')
{
    $csrf = csrf_field();
    return <<<EOT
        <form method="POST" action="{$action}" class="display:inline;">
         <input type='hidden' name='_method' value='{$type}'>
         {$csrf}
         <button type="submit" class="{$button_class}">{$body}</button>
EOT;
}
예제 #6
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $view = '<form method="POST" action="/books/create">';
     $view .= csrf_field();
     # This will be explained more later
     $view .= '<label>Title: <input type="text" name="title"></label>';
     $view .= '<input type="submit">';
     $view .= '</form>';
     return $view;
 }
예제 #7
0
    public function getFileupload()
    {
        $postUrl = '/request/fileupload';
        $csrf_field = csrf_field();
        $html = <<<CREATE
            <form action="{$postUrl}" method="POST" enctype="multipart/form-data">
                {$csrf_field}
                <input type="file" name="file"/><br/><br/>
                <input type="submit" value="提交"/>
            </form>
CREATE;
        return $html;
    }
    public function create()
    {
        $postUrl = route('post.store');
        $csrf_field = csrf_field();
        $html = <<<CREATE
        <form action="{$postUrl}" method="POST">
            {$csrf_field}
            <input type="text" name="title"><br/><br/>
            <textarea name="content" cols="50" rows="5"></textarea><br/><br/>
            <input type="submit" value="提交"/>
        </form>
CREATE;
        return $html;
    }
예제 #9
0
 public function getFieldsHtml()
 {
     if ($this->_validator) {
         $messages = $this->_validator->messages();
     }
     $html = '';
     foreach ($this->_fields as $field) {
         $html .= $field->getHtml(isset($messages) ? $messages->get($field->getName()) : []);
     }
     if ($this->_token) {
         $html .= csrf_field();
     }
     return $html;
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $model = new TaskStatus();
     $dataGrid = DataGrid::make($model);
     $dataGrid->addColumn(DataGrid::textColumn('name', 'Status Name', ['sortable' => 'asc']));
     if (Gate::allows('hasPermission', [AdminUser::class, "setup.task-status.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('setup.task-status.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "setup.task-status.destroy"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('setup.task-status.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('setup.task-status.index')->with('dataGrid', $dataGrid);
 }
예제 #11
0
 public static function begin($action = false, $method = false, array $options = array(), $enctype = false)
 {
     $html = '<form';
     if (!empty($action)) {
         $html .= " action='{$action}'";
     }
     if (!empty($method)) {
         $html .= " method='{$method}'";
     }
     if (!empty($enctype)) {
         $html .= "enctype='multipart/form-data'";
     }
     $html .= self::generateOption($options);
     $html .= '>';
     echo $html;
     echo csrf_field();
     return new ActiveForm();
 }
예제 #12
0
    /**
     * Open up a new HTML form.
     *
     * @param  array $options
     *
     * @return string
     */
    public static function open($options=[]){
        $method = array_get($options, 'method', 'post');
        $method = strtoupper($method);
        $options['method'] = ($method == 'POST' or in_array($method, self::$fake_methods)) ? 'POST' : 'GET';
        if (isset($options['files'])){
            if ($options['files']===true) {
                $options['enctype'] = 'multipart/form-data';
            }
            unset($options['files']);
        }

        if (!isset($options['action'])) {
            $options['action'] = Request::url();
        }
        $options['accept-charset'] = 'UTF-8';

        return '<form'.self::getHtmlParamsFromOptions($options).'>'.csrf_field().self::getAppendMethod($method);
    }
예제 #13
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $role = new Role();
     $dataGrid = DataGrid::make($role);
     $dataGrid->addColumn(DataGrid::textColumn('name', 'Role Name'));
     $dataGrid->addColumn(DataGrid::textColumn('description', 'Role Description'));
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.role.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('admin.role.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.role.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('admin.role.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('admin.user.role.index')->with('dataGrid', $dataGrid);
 }
function link_to($body, $path, $type)
{
    $csrf = csrf_field();
    if (is_object($path)) {
        $action = '/' . $path->getTable();
        if (in_array($type, ['PUT', 'PATCH', 'DELETE'])) {
            $action .= '/' . $path->getKey();
        }
    } else {
        $action = $path;
    }
    return <<<EOT
    <form method="POST" action="{$action}">
        {$csrf}
        <input type="hidden" name="_method" value="{$type}">
        <button type="submit">{$body}</button>
    </form>
EOT;
}
예제 #15
0
function form_handle($body, $path, $type)
{
    $csrf = csrf_field();
    if (is_object($path)) {
        $action = '/' . $path->getTable();
        if (in_array($type, ['PUT', 'PATCH', 'DELETE'])) {
            $action .= '/' . $path->getKey();
        }
    } else {
        $action = $path;
    }
    return <<<EOT
\t\t<form method="POST" action="{$action}">
\t\t\t{$csrf}
\t\t\t<input type='hidden' name='_method' value="{$type}" />
\t\t\t<button type="submit">{$body}</button>
\t\t</form>
EOT;
}
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $model = new OrderStatus();
     $dataGrid = DataGrid::make($model);
     $dataGrid->addColumn(DataGrid::textColumn('id', 'Order ID'));
     $dataGrid->addColumn(DataGrid::textColumn('title', 'Title'));
     $dataGrid->addColumn(DataGrid::textColumn('is_default', 'Is Default'));
     $dataGrid->addColumn(DataGrid::textColumn('is_last_stage', 'Is Last Stage'));
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.order-status.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('admin.order-status.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.order-status.destroy"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('admin.order-status.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('admin.order-status.index')->with('dataGrid', $dataGrid);
 }
예제 #17
0
 public function index()
 {
     $model = new Review();
     $dataGrid = DataGrid::make($model);
     $dataGrid->addColumn(DataGrid::textColumn('id', 'Id'));
     $dataGrid->addColumn(DataGrid::textColumn('user_name', 'User Name'));
     $dataGrid->addColumn(DataGrid::textColumn('product_title', 'Product Title'));
     $dataGrid->addColumn(DataGrid::textColumn('star', 'Product Title'));
     $dataGrid->addColumn(DataGrid::textColumn('status', 'Status'));
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.review.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('admin.review.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.review.destroy"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('admin.review.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('admin.review.index')->with('dataGrid', $dataGrid);
 }
예제 #18
0
 public function get_ajax($draw, $start, $length, $sortCol, $sortDir, $search)
 {
     $columns = ['id', 'activated_at', 'activated_at', 'email', 'newsletter_id'];
     $iTotal = $this->user->all()->count();
     if ($search) {
         $data = $this->user->where('email', 'LIKE', '%' . $search . '%')->with(['subscriptions'])->orderBy($columns[$sortCol], $sortDir)->take($length)->skip($start)->get();
         $recordsTotal = $data->count();
     } else {
         if ($sortCol == 4) {
             $data = $this->user->with(['subscriptions' => function ($query) use($sortDir) {
                 $query->orderBy('newsletter_id', $sortDir);
             }])->take($length)->skip($start)->get();
         } else {
             $data = $this->user->with(['subscriptions'])->orderBy($columns[$sortCol], $sortDir)->take($length)->skip($start)->get();
         }
         $recordsTotal = $iTotal;
     }
     $output = array("draw" => $draw, "recordsTotal" => $iTotal, "recordsFiltered" => $recordsTotal, "data" => []);
     foreach ($data as $abonne) {
         $row = [];
         $row['id'] = '<a class="btn btn-sky btn-sm" href="' . url('admin/subscriber/' . $abonne->id) . '">&Eacute;diter</a>';
         // $row['status']['display']   = ($abonne->activated_at ? '<span class="label label-success">Confirmé</span>' : '<span class="label label-default">Email non confirmé</span>');
         //$row['status']['timestamp'] = $abonne->activated_at;
         $row['status'] = $abonne->activated_at ? '<span class="label label-success">Confirmé</span>' : '<span class="label label-default">Email non confirmé</span>';
         $row['activated_at'] = $abonne->activated_at ? $abonne->activated_at->formatLocalized('%d %B %Y') : '';
         $row['email'] = $abonne->email;
         $row['abo'] = '';
         if (!$abonne->subscriptions->isEmpty()) {
             $abos = $abonne->subscriptions->lists('titre')->all();
             $row['abo'] = implode(',', $abos);
         }
         $row['delete'] = '<form action="' . url('admin/subscriber/' . $abonne->id) . '" method="POST">' . csrf_field() . '<input type="hidden" name="_method" value="DELETE">';
         $row['delete'] .= '<input type="hidden" name="email" value="' . $abonne->email . '">';
         $row['delete'] .= '<button data-what="supprimer" data-action="Abonné ' . $abonne->email . '" class="btn btn-danger btn-xs deleteAction pull-right">Supprimer</button>';
         $row['delete'] .= '</form>';
         //$row = array_values($row);
         $output['data'][] = $row;
     }
     return json_encode($output);
 }
예제 #19
0
파일: functions.php 프로젝트: anjuna/spicy
function link_to($message, $path, $method)
{
    $csrf = csrf_field();
    if (is_object($path)) {
        $action = $path->getTable();
        if (in_array($method, ['PUT', 'PATCH', 'DELETE'])) {
            $action .= '/' . $path->getKey();
        }
    } else {
        $action = $path;
    }
    return <<<EOT
\t<form method="post" action="{$action}">

\t\t{$csrf}

\t\t<input type="hidden" name="_method" value="{$method}" />

\t\t<button type="submit">{$message}</button>

\t</form>
EOT;
}
예제 #20
0
function link_to($body, $path, $type)
{
    if (is_object($path)) {
        // $photo, DELETE --> DELETE /photos/id
        $action = '/' . $path->getTable();
        // photos
        if (in_array($type, ['PUT', 'PATCH', 'DELETE'])) {
            $action .= '/' . $path->getKey();
            // photos/1
        }
    } else {
        $action = $path;
    }
    $csrf = csrf_field();
    return <<<EOT
        <form method="POST" action="{$action}">
            <input type='hidden' name='_method' value='{$type}'>
                {$csrf}
            <button type="submit">{$body}</button>
       </form>


EOT;
}
예제 #21
0
 public function renderNode($node)
 {
     $form = '<form action="' . url('admin/page/' . $node->id) . '" method="POST">
                           <input type="hidden" name="_method" value="DELETE">' . csrf_field() . '
                           <a href="admin/page/' . $node->id . '" class="btn btn-info btn-sm">&eacute;diter</a>
                           <button data-action="page: ' . $node->title . '" class="btn btn-danger btn-sm deleteAction">X</button>
                       </form>';
     if ($node->isLeaf()) {
         return '<li class="dd-item" data-id="' . $node->id . '" id="page_rang_' . $node->id . '"><div class="dd-handle">
                 <i class="fa fa-crosshairs"></i> &nbsp; <a href="admin/page/' . $node->id . '">' . $node->title . '</a>' . $form . '</div></li>';
     } else {
         $html = '<li class="dd-item" data-id="' . $node->id . '"><div class="dd-handle">';
         $html .= '<a href="admin/page/' . $node->id . '">' . $node->title . '</a>';
         $html .= $form;
         $html .= '</div>';
         $html .= '<ol class="dd-list">';
         foreach ($node->children as $child) {
             $html .= $this->renderNode($child);
         }
         $html .= '</ol>';
         $html .= '</li>';
     }
     return $html;
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $projects = Project::paginate(10);
     $project = new Project();
     $dataGrid = DataGrid::make($project);
     $dataGrid->addColumn(DataGrid::textColumn('name', 'Project Name', ['sortable' => 'asc']));
     $dataGrid->addColumn(DataGrid::textColumn('description', 'Project Description'));
     if (Gate::allows('hasPermission', [AdminUser::class, "project.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('project.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "project.destroy"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('project.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "project.show"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('show', 'Show', function ($row) {
             return "<a href='" . route('project.show', $row->id) . "'>Show</a>";
         }));
     }
     return view('project.project.index')->with('dataGrid', $dataGrid);
 }
<link rel='stylesheet' type='text/css' href={{URL::asset('css/group-member-list.css')}}>
@endsection

@section('group-content')
<div id='group-home-container' class='group-content-container'>
	<div class='my-wish-list'>
		<div class='title'>
			<h3>{{$member->name}}'s Wish List</h3>
		</div>
		<div class='my-items'>
<?php 
//echo '<pre>' . print_r($users_items, true) . '</pre>';
foreach ($members_items as $item) {
    echo "\n\t\t\t<div class='my-item'>\n\t\t\t\t<div class='info'>\n\t\t\t\t\t<div class='rank'>" . "<p>Rank</p><p class='rank-int'>" . $item->rank . "</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='details'>\n\t\t\t\t\t\t<div class='name'>" . $item->name . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class='specifications'>" . $item->specifications . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class='link'>" . "<a href='" . $item->link . "'>" . $item->link . "</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='cleared-div'>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class='reserved'>";
    if ($item->reserved_by == 'none') {
        echo "\n\t\t\t\t<form method='post' action='" . url('group/' . $group_data['id'] . '/reserve/') . "'>";
        echo csrf_field() . "\n\t\t\t\t\t<input type='hidden' name='item_id' value='" . $item->id . "'>\n\t\t\t\t\t<input type='hidden' name='member_id' value='" . $member->id . "'>\n\t\t\t\t\t<button type='submit' name='reserve'><span class='reserve-item-text'>Reserve Item</span></button>\n\t\t\t\t</form>\n\t\t\t";
    } else {
        echo "<span class='item-reserved-text'>Item Reserved</span>";
    }
    echo "\n\t\t\t\t\t</div>\n\t\t\t\t<div class='cleared-div'>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t";
}
?>
			
		</div>
	</div>
</div>
@endsection

@section('group-javascript')
@endsection
예제 #24
0
<div class="ui very padded basic segment container">
	<h1 class="ui dividing header">Project toevoegen</h1>
	<form method="post" action="<?php 
print action('ProjectController@postCreate');
?>
">
		<?php 
print csrf_field();
?>
		<div class="ui form">
			<div class="required field">
				<label for="name">Projectnaam</label>
				<input type="text" name="name" placeholder="De naam van het project" />
			</div> <!-- /.required /.field -->

			<div class="required field">
				<label for="start_date">Startdatum</label>
				<input type="text" name="start_date" placeholder="De startdatum van het project" value="<?php 
print $now;
?>
" />
			</div> <!-- /.required /.field -->

			<div class="field">
				<label for="end_date">Einddatum (optioneel)</label>
				<input type="text" name="end_date" placeholder="De einddatum van het project" />
			</div> <!-- /.field -->

			<div class="field">
				<label for="description">Projectomschrijving</label>
				<textarea name="description" placeholder="Een (korte) projectomschrijving"></textarea>
<ul class="action">
    <li>
        <form action="<?php 
echo e(url('admin/team/delete/' . $tim->id));
?>
" method="POST">
            <?php 
echo e(csrf_field());
?>

            <?php 
echo e(method_field('DELETE'));
?>

            <button class="btn btn-danger">
                Hapus
            </button>
        </form>
    </li>
    <li>
        <a href="<?php 
echo e(url('admin/team/edit/' . $tim->id));
?>
">
            <button class="btn btn-warning">
                Edit
            </button>
        </a>
    </li>
    <li>
        <a href="<?php 
예제 #26
0
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href=".">Extraxcel</a>
    </div>
    <div class="navbar-collapse collapse">
      <ul class="nav navbar-nav navbar-right">
        <li><a href='clear'>クリア</a></li>
      </ul>
    </div>
  </div>
</div>

<div class="container-fluid">
    <?php 
echo csrf_field() . "\n";
?>
    <div class="row">
<?php 
//////////////////////////////
// ファイルリスト
$no = 0;
$total_size = 0;
$str = "";
foreach ($objDataset->files as $fileidx => $file) {
    $no = $fileidx + 1;
    $total_size += $file['size'];
    $cls = empty($file['error']) ? "" : "class='error'";
    $str .= "<li data-fileidx='" . e($fileidx) . "' " . $cls . ">\n";
    $str .= "<span>No." . e($no) . "</span>\n";
    $str .= "<span class='size'>" . e($file['size_si']) . "</span>\n";
예제 #27
0
 public function get_ajax($draw, $start, $length, $sortCol, $sortDir, $search)
 {
     $columns = ['id', 'nom', 'email', 'adresse'];
     $iTotal = $this->user->all()->count();
     if ($search) {
         $data = $this->user->where('email', 'LIKE', '%' . $search . '%')->with(['adresses'])->orderBy($columns[$sortCol], $sortDir)->take($length)->skip($start)->get();
         $recordsTotal = $data->count();
     } else {
         $data = $this->user->with(['adresses'])->orderBy($columns[$sortCol], $sortDir)->take($length)->skip($start)->get();
         $recordsTotal = $iTotal;
     }
     $output = array("draw" => $draw, "recordsTotal" => $iTotal, "recordsFiltered" => $recordsTotal, "data" => []);
     foreach ($data as $user) {
         $row = [];
         $row['id'] = '<a class="btn btn-sky btn-sm" href="' . url('admin/user/' . $user->id) . '">&Eacute;diter</a>';
         $row['nom'] = $user->name;
         $row['email'] = $user->email;
         $row['adresse'] = '';
         if (!$user->adresses->isEmpty()) {
             $html = '<ul class="list-group" style="margin-bottom: 0;">';
             foreach ($user->adresses as $adresse) {
                 $html .= '<li class="list-group-item">';
                 $html .= $adresse->type_title;
                 $html .= '<a href="' . url('admin/adresse/' . $adresse->id) . '" class="btn btn-xs btn-info pull-right">éditer</a>';
                 $html .= '</li>';
             }
             $html .= '</ul>';
             $row['adresse'] = $html;
         }
         $row['delete'] = '<form action="' . url('admin/user/' . $user->id) . '" method="POST">' . csrf_field() . '<input type="hidden" name="_method" value="DELETE">';
         $row['delete'] .= '<button data-what="supprimer" data-action="Abonné ' . $user->name . '" class="btn btn-danger btn-xs deleteAction pull-right">Supprimer</button>';
         $row['delete'] .= '</form>';
         //$row = array_values($row);
         $output['data'][] = $row;
     }
     return json_encode($output);
 }
 function testaddProfile()
 {
     $x = csrf_field();
     $response = $this->call('POST', '/api/eis/eid/34/profile');
     //$this->assertEquals(200, $response->status());
 }
예제 #29
0
@extends('login.layouts.template')
@section('content')
<?php 
echo csrf_field();
?>

<div class="row">
 <div class="col-md-4 col-md-offset-4">
 <div class="login-panel panel panel-default">
 <div class="panel-heading">
 <h3 class="panel-title">เข้าสู่ระบบ</h3>
 </div>
 @if(Session::has('message'))
 <div class="panel-body bg-danger color-red">
 {{Session::get('message')}}
 </div>
 @endif
 <div class="panel-body">
 <form role="form" method="POST" action="{{ url('/login/loginframe/process') }}">
 <input type="hidden" name="_token" value="{{ csrf_token() }}">
 <fieldset>
 <div class="form-group">
 <input required class="form-control" placeholder="Username" name="username" type="text" autofocus value="{{old('username')}}"/>
 {!!$errors->first('username', '<span
 class="control-label color-red" for="username">*:message</span>')!!}
 </div>
 <div class="form-group">
 <input required class="form-control" placeholder="Password" name="password" type="password" value="">
 {!!$errors->first('password', '<span
 class="control-label error" for="password">*:message</span>')!!}
 </div>
예제 #30
0
Route::post('password/email', 'Auth\\PasswordController@postEmail');
// 密码重置路由...
Route::get('password/reset/{token}', 'Auth\\PasswordController@getReset');
Route::post('password/reset', 'Auth\\PasswordController@postReset');
//定义一个路由组
Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => 'auth'], function () {
    Route::get('/', 'AdminHomeController@index');
    Route::resource('pages', 'PagesController');
    Route::resource('comments', 'CommentsController');
});
/**
 * HTTP 路由
 */
//Test Csrf
Route::get('testCsrf', function () {
    $csrf_field = csrf_field();
    $html = <<<GET
        <form method="POST" action="/testCsrf">
            {$csrf_field}
            <input type="submit" value="Test"/>
        </form>
GET;
    return $html;
});
Route::post('testCsrf', function () {
    return 'Success!';
});
Route::get('404', function () {
    abort(404);
});
/**