当前位置: 首页>>代码示例>>PHP>>正文


PHP Error::make方法代码示例

本文整理汇总了PHP中Error::make方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::make方法的具体用法?PHP Error::make怎么用?PHP Error::make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Error的用法示例。


在下文中一共展示了Error::make方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUser

 public function getUser($id)
 {
     $user = User::find($id);
     if (is_null($user)) {
         return Error::make("Invalid User");
     }
     return Error::success("User Details", $user->toArray());
 }
开发者ID:prateekchandan,项目名称:dipatchtaxicab-server,代码行数:8,代码来源:APIController.php

示例2: send_activation_mail_api

 public function send_activation_mail_api($id)
 {
     $user = User::find($id);
     if (is_null($user)) {
         return Error::make("Invalid User");
     }
     return $this->send_activation_mail_helper($user);
 }
开发者ID:prateekchandan,项目名称:dipatchtaxicab-server,代码行数:8,代码来源:UserController.php

示例3: function

/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
    if (Session::token() != Input::get('_token')) {
        throw new Illuminate\Session\TokenMismatchException();
    }
});
App::missing(function ($exception) {
    return Error::make(404, 404);
});
Route::filter('API', function () {
    if (Input::has('key')) {
        if (Input::get('key') != "teninchlong") {
            return Error::make(401, 401);
        }
    } else {
        return Error::make(1, 2);
    }
});
Route::filter('afterAPI', function ($request, $response) {
    $response->header('Content-Type', 'application/json');
    return $response;
});
开发者ID:martiansideofthemoon,项目名称:Labman-Server,代码行数:31,代码来源:filters.php

示例4: dispatchController

 public function dispatchController($match)
 {
     $controller = @explode('@', $match['target'])[0];
     $method = @explode('@', $match['target'])[1];
     if (class_exists($controller)) {
         $dispatchedController = new $controller();
         if (method_exists($dispatchedController, $method)) {
             if (!empty($match['params'])) {
                 $params = json_decode(json_encode($match['params']));
                 return $dispatchedController->{$method}($params);
             }
             return $dispatchedController->{$method}();
         }
         return Error::make('Route does not exist');
     }
     return Error::make('Route does not exist!');
 }
开发者ID:askoxyz,项目名称:elsa,代码行数:17,代码来源:Router.php

示例5: add_result

 public function add_result()
 {
     $requirements = ['exp_id', 'user_id', 'data'];
     $check = self::check_requirements($requirements);
     if ($check) {
         return Error::make(0, 100, $check);
     }
     $experiment = Experiment::where('exp_id', '=', Input::get('exp_id'))->first();
     if (is_null($experiment)) {
         return Error::make(1, 10);
     }
     $user = User::where('user_id', '=', Input::get('user_id'))->first();
     if (is_null($user)) {
         return Error::make(1, 1);
     }
     if (Input::has('result_id')) {
         $res = Result::where('result_id', '=', Input::get('result_id'))->first();
         if (intval(Input::get('exp_id')) != intval($res->exp_id)) {
             return Error::make(1, 11);
         }
         if (intval(Input::get('user_id')) != intval($res->user_id)) {
             return Error::make(1, 12);
         }
     }
     $columns = json_decode($experiment->specifications, true)["columns"];
     $results = json_decode(Input::get('data'), true);
     foreach ($results as $reading) {
         foreach ($columns as $column) {
             if (array_key_exists($column["title"], $reading)) {
                 if (!is_null($column["subcolumns"]) && sizeof($column["subcolumns"]) > 0) {
                     foreach ($column["subcolumns"] as $subcolumn) {
                         if (!array_key_exists($subcolumn["title"], $reading[$column["title"]])) {
                             return Error::make(101, 101, "Column " . $column["title"] . " has missing subcolumn " . $subcolumn["title"]);
                         }
                     }
                 }
             } else {
                 return Error::make(101, 101, "Missing column " . $column["title"]);
             }
         }
     }
     if (Input::has('result_id')) {
         try {
             Result::where('result_id', '=', intval(Input::get('result_id')))->update(array('data' => json_encode($results)));
             return Error::success("Results successfully updated", array('result_id' => intval(Input::get('result_id'))));
         } catch (Exception $e) {
             return Error::make(101, 101, $e->getMessage());
         }
     } else {
         $res = new Result();
         $res->data = json_encode($results);
         $res->user_id = intval(Input::get('user_id'));
         $res->exp_id = intval(Input::get('exp_id'));
         try {
             $res->save();
             return Error::success("Result successfully added!", array('result_id' => $res->id));
         } catch (Exception $e) {
             return Error::make(101, 101, $e->getMessage());
         }
     }
 }
开发者ID:martiansideofthemoon,项目名称:Labman-Server,代码行数:61,代码来源:HomeController.php

示例6: edit_pic_api

 public function edit_pic_api($id)
 {
     $user = User::find($id);
     if (is_null($user)) {
         return Error::make("Invalid User");
     }
     if ($user->type != "driver") {
         return Error::make("User is not Driver");
     }
     $this->edit_pic_helper($user);
     $data = Driver::find($id)->toArray();
     return Error::success("Successfully Uploaded pictures", $data);
 }
开发者ID:prateekchandan,项目名称:dipatchtaxicab-server,代码行数:13,代码来源:HomeController.php

示例7: function

    });
});
Route::group(array('before' => 'guest'), function () {
    Route::get('login', array('uses' => 'UserController@show_login'));
    Route::post('login', array('as' => 'login', 'uses' => 'UserController@login'));
    Route::post('register', array('as' => 'register', 'uses' => 'UserController@register'));
});
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is all the routes which will help the laravel application to run.
|
*/
Route::group(array("prefix" => "api"), function () {
    Route::post('login', array('uses' => 'UserController@login'));
    Route::post('register', array('uses' => 'UserController@register'));
    Route::get('user/{id}', array('uses' => 'APIController@getUser'));
    Route::get('customer/{id}', array('uses' => 'APIController@getCustomer'));
    Route::get('driver/{id}', array('uses' => 'APIController@getDriver'));
    Route::get('business/{id}', array('uses' => 'APIController@getBusiness'));
    Route::post('edit/{id}', array('uses' => 'HomeController@api_edit'));
    Route::post('edit_pic/{id}', array('uses' => 'HomeController@edit_pic_api'));
    Route::get('activation/{id}', array('uses' => 'UserController@send_activation_mail_api'));
    Route::any('{e1?}/{e2?}/{e3?}/{e4?}/{e5?}/{e6?}/{e7?}/{e8?}', function () {
        return Error::make("Invalid URL. Page don't exists");
    });
});
Route::controller('password', 'RemindersController');
Route::get('activate/{id}', array('uses' => 'UserController@activate'));
开发者ID:prateekchandan,项目名称:dipatchtaxicab-server,代码行数:31,代码来源:routes.php


注:本文中的Error::make方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。