コード例 #1
0
ファイル: Cluster.php プロジェクト: kevineger/rally
 /**
  * Build a new cluster photo instance.
  *
  * @param $subreddit
  * @return mixed
  */
 public static function named($subreddit)
 {
     $cluster = new Cluster();
     $cluster->name = $subreddit;
     $cluster->saveAs($subreddit);
     $cluster->save();
     return $cluster;
 }
コード例 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param Request $request
  * @param Cluster $cluster
  * @return Response
  * @internal param int $id
  */
 public function update(Request $request, Cluster $cluster)
 {
     $cluster->name = $request->name;
     $cluster->ip = $request->ip;
     $cluster->username = $request->username;
     $cluster->user_type = $request->user_type;
     $cluster->version = $request->version;
     $cluster->verify_peer = $request->verify_peer ? true : false;
     $cluster->password = checkPassword($cluster->password, $request->password);
     $cluster->save();
     if ($request->active) {
         \Auth::user()->clusters_id = $cluster->id;
     } elseif (!isset($request->active) && \Auth::user()->clusters_id == $cluster->id) {
         \Auth::user()->clusters_id = null;
     }
     \Auth::user()->save();
     Flash::success('Cluster info updated!');
     return redirect()->action('ClusterController@index');
 }