jeudi 2 février 2017

Syntax error in other file when adding a foreach

Here's the error i'm getting :

syntax error, unexpected end of file, expecting function (T_FUNCTION)' in D:\User\Documents...\Controllers\DeviceController.php:68

It happens in this code :

<?php namespace App\Http\Controllers;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Data\Campaign;
use App\Data\Device;
use App\Helpers\Database;
use App\Helpers\DateHelpers;
use App\Helpers\ProfileHelpers;
use App\Helpers\Utils;
use Illuminate\Http\Request;

class DeviceController extends ApiController
{
    public function show($deviceId)
    {
        return Device::find($deviceId);
    }

    public function update(Request $request, $deviceId)
    {
        $isAlertActive = filter_var($request->input('isAlertActive'), FILTER_VALIDATE_BOOLEAN);
        $isAlertAfter5Pushes = filter_var($request->input('isAlertAfter5Pushes'), FILTER_VALIDATE_BOOLEAN);
        $isAlertAfter10Pushes = filter_var($request->input('isAlertAfter10Pushes'), FILTER_VALIDATE_BOOLEAN);
        $hasAtLeastOneSettingActive = $isAlertActive || $isAlertAfter5Pushes || $isAlertAfter10Pushes;

        $settings = [
            'is_alert' => $isAlertActive,
            'is_alert_after_5_pushes' => $isAlertAfter5Pushes,
            'is_alert_after_10_pushes' => $isAlertAfter10Pushes
        ];

        if ($isAlertActive) {
            $settings['alert_seuil'] = intval($request->input('alertThreshold'));
            $settings['alert_votemini'] = intval($request->input('minVoteCountBeforeAlert'));
        }

        if ($hasAtLeastOneSettingActive)
            $settings['next_alert_in_hours'] = intval($request->input('nextAlertInHours'));

        Device::where('id_device', $deviceId)
              ->update($settings);
    }

/////////////////////////////////////////////////////////////////////////////

    public function putInLocation($sectionId, $locationName)
    {
        $section = Section::find($sectionId);
        if ($section && $section->area->id_client == $this->clientId) {
            Location::createLocation($sectionId, $locationName);
            return self::jsonSuccess();
        }
        else
            return self::jsonBadRequest();
    }

    public function delete($locationId)
    {
        $location = Location::find($locationId);
        if ($location && $location->section->area->id_client == $this->clientId) {
            $location->delete();
            return self::jsonSuccess();
        }
        else
            return self::jsonBadRequest();
    }
}
?>

I don't see any syntax error there, i checked the brackets multiple times but maybe i missed something ?

What's weird for me is that there is no syntax error until i add a foreach in another file (D:\User\Documents...\Views\Partials\areasettings.php). Here's the foreach :

<div class="col-lg-3 col-lg-offset-0 v">
    <div class="input-group">
        <span class="input-group-addon"><span class="glyphicon glyphicon-barcode"></span></span>
        <select class="form-control" id="deviceSelect"> 
            <option selected disabled> <?php echo trans('areasettings.add_id_placeholder') ?> </option>
            <option> TEST </option>
            <?php 
            $devices = $db->fetchAll("select `id_device_mac` from `dashboard_demo.nao_device`");
            foreach ($devices as $device) {
                $idDevice = $device->id_device;
                $idDeviceMac = $device->id_device_mac;
                //echo "<option value=\"$idDevice\">$idDeviceMac</option>\n";
                <option value="<?= $device['id_device_mac'] ?>"><?= $device['id_device_mac'] ?></option>
            }
            ?>
        </select>
        <!--<input type="text" class="form-control" placeholder="<?php echo trans('areasettings.add_id_placeholder') ?>" autocomplete="off"
            ng-model="newSectionName">-->
    </div>
</div>

Thanks in advance for helping me !



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2jBHSPJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire