我有一个搜索表单和功能,都完成了.只是问一下,是否可以在Eloquent中执行这样的查询:
SELECT * FROM players WHERE name LIKE '%".$name."%'
Run Code Online (Sandbox Code Playgroud)
显示一些可能的匹配名称.我目前的控制器功能:
public function search()
{
$name = Input::get('character');
$searchResult = Player::where('name', '=', $name)->paginate(1);
return View::make('search.search')
->with('name', $name)
->with('searchResult', $searchResult);
}
Run Code Online (Sandbox Code Playgroud)
我的观点是:
<form id="custom-search-form" class="form-search form-horizontal pull-right" action="{{ URL::action('CharactersController@search') }}" method="get">
<div class="input-append spancustom">
<input type="text" class="search-query" name="character" placeholder="Character/guild name">
<button type="submit" class="btn"><i class="icon-search"></i></button>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我在我的特定视图/网站中设置了分页,并且它有效.
问题是我有一个PHP计数器:
<?php $count = 0;?>
@foreach ($players as $player)
<?php $count++;?>
<tr>
<td>{{ $count }}. </td>
Run Code Online (Sandbox Code Playgroud)
每当我切换页面时,它从1开始.
我怎么能改变呢?
第一个问题:
我已经在许多类型的文本和事物中插入了本地化,但我不知道如何将其导入到以下形式:
{{ Form::label('name', 'here') }}
{{ Form::text('name', null, array('placeholder' => 'here')) }}
{{ Form::submit('here', array('class' => 'btn btn-success')) }}
{{ Form::button('here', array('class' => 'btn btn-default')) }}
Run Code Online (Sandbox Code Playgroud)
我希望它在表单标签'here'和文本'here'的占位符中.
第二个问题:
我不允许在我的语言文件中插入链接: text here blah blah <a href="{{ URL::to('text') }}">BLAH</a>?
无论如何插入链接?
提前致谢.
这是我的PHP脚本:
<?php
$address = htmlentities(strtolower(Config::get('aac.ip')));
$port = Config::get('aac.port');
@$sock = fsockopen ($address, $port, $errno, $errstr, 1);
if(!$sock) echo '<small class="muted"><strong>Server status:</strong></small> <span class="label label-important">OFFLINE</span><br />'; else {
$info = chr(6).chr(0).chr(255).chr(255).'info';
fwrite($sock, $info);
$data='';
while (!feof($sock))$data .= fgets($sock, 1024);
fclose($sock);
// if needed
// var_dump($data);
preg_match('/players online="(\d+)" max="(\d+)"/', $data, $matches);
$players = ''.$matches[1].' / '.$matches[2];
preg_match('/uptime="(\d+)"/', $data, $matches);
$h = floor($matches[1] / 3600);
$m = floor(($matches[1] - $h*3600) / 60);
$uptime = ''.$h.'h '.$m.'m';
preg_match('/monsters total="(\d+)"/', $data, $matches);
$monsters = ''.$matches[1]; …Run Code Online (Sandbox Code Playgroud) 这是我正在尝试做的事情(我的代码):
@extends('base')
@section('title', 'Quests')
@stop
@section('main')
<? $quests = array (
1 => array ( "name" => "Quest 1", "level" => 100, "description" => "Write your description here", "reward" => "Shield, Boots"),
2 => array ( "name" => "Quest 2", "level" => 100, "description" => "4 Peoples needed!", "reward" => "Sword, Stonecutter Axe, Armor, Present(choose 1)"),
3 => array ( "name" => "Inferno Quest", "level" => 100, "description" => "Very hard quest. You need a big team to do this …Run Code Online (Sandbox Code Playgroud)