Ejemplo n.º 1
0
 public function createEntry(Request $request)
 {
     $entry = new Entry();
     $entry->title = $request->input('title');
     $entry->content = nl2br($request->input('content'));
     $entry->price = $request->input('price');
     $entry->currency = $request->input('currency');
     $entry->audience = implode(', ', $request->input('audience'));
     $entry->location = $request->input('location');
     $entry->user_id = Auth::user()->id;
     $entry->save();
     return redirect()->route('viewEntry', ['id' => $entry->id]);
 }
Ejemplo n.º 2
0
 /**
  * Toggles a goal between completed and not (by adding or deleting a record)
  * @param  integer  $id      The ID of the goal to toggle.
  * @param  Request $request The request.
  * @return mixed           Either the newly created completion, or true (?)
  * @todo Make this code more concise.
  */
 public function toggleGoal($id, Request $request)
 {
     if ($entry = Entry::where('goal_id', $id)->where('user_id', \Auth::user()->id)->where('completed_on', Carbon::today())->first()) {
         $entry->delete();
         return json_encode('true');
     }
     $entry = new Entry();
     $entry->goal_id = $id;
     # TODO maybe use Laravel's relationships more here
     $entry->user_id = \Auth::user()->id;
     $entry->completed_on = Carbon::today();
     $entry->save();
     return $entry;
 }
Ejemplo n.º 3
0
 public function search(Request $request)
 {
     $searchTerm = is_null($request->input('query')) ? "" : $request->input('query');
     $city = is_null($request->input('city')) ? '' : $request->input('city');
     $category = is_null($request->input('category')) ? "" : $request->input('category');
     $participants = is_null($request->input('participants')) ? "" : $request->input('participants');
     $min = is_null($request->input('min_budget')) ? 0 : $request->input('min_budget');
     $max = is_null($request->input('max_budget')) ? 2147483647 : $request->input('max_budget');
     $entries = Entry::where('title', 'LIKE', "%{$searchTerm}%")->where('city', 'LIKE', "%{$city}%")->where('address', 'LIKE', "%{$city}%")->where('categories', "LIKE", "%{$category}%")->where('participants', 'LIKE', "%{$participants}%")->where('budget', '>=', $min)->where('budget', '<=', $max)->with('days')->with('hours')->with('tags');
     /*if($searchTerm != ''){
           $entries = Entry::where('title','LIKE',"%$searchTerm%");
       } else if($city != ''){
           $entries = $entries->where('description','LIKE',"%$searchTerm%");
       } else if($category != ''){
           $entries = $entries->where('categories','LIKE',"%$categories%");
       } else if($participants != ''){
           $entries = $entries->where('participants','LIKE',"");
       }*/
     $entries = $entries->get();
     $tags = Tag::where('description', 'LIKE', "%{$searchTerm}%")->get();
     foreach ($tags as $tag) {
         $entries->merge($tag->entry()->get());
     }
     header("Access-Control-Allow-Origin: *");
     header("Access-Control-Allow-Credentials: true ");
     header("Access-Control-Allow-Methods: OPTIONS, GET, POST");
     header("Access-Control-Allow-Headers: Content-Type, Depth, User-Agent, X-File-Size, \n          X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control");
     return $entries->toJson();
 }
Ejemplo n.º 4
0
 /**
  * Return the number of free places on this detail
  */
 public function placesLeft()
 {
     $entries = Entry::where('detail_id', '=', $this->id);
     $numEntries = $entries->count();
     $left = $this->max - $numEntries;
     return $left;
 }
Ejemplo n.º 5
0
 public function run()
 {
     DB::table('entries')->delete();
     Entry::create(array('title' => 'Go skydiving', 'completed' => True));
     Entry::create(array('title' => 'Finish this app', 'completed' => True));
     Entry::create(array('title' => 'Run a marathon'));
 }
Ejemplo n.º 6
0
 public function update($id)
 {
     $data = Request::all();
     $entry = Entry::find($id);
     $entry->fill($data);
     $entry->save();
     return response()->json($entry);
 }
Ejemplo n.º 7
0
 /**
  * Show all entries
  *
  * Get a JSON representation of all the registered users.
  *
  * @Get("/{id}")
  * @Versions({"v1"})
  */
 public function show($id)
 {
     try {
         return Entry::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         throw new ResourceException("No user record found.");
     }
 }
Ejemplo n.º 8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Entry::truncate();
     Entry::create(['name' => 'entry 1']);
     Entry::create(['name' => 'entry 2']);
     Entry::create(['name' => 'entry 3']);
     Entry::create(['name' => 'entry 4']);
     Entry::create(['name' => 'entry 5']);
 }
Ejemplo n.º 9
0
 function getOne($id_game)
 {
     $game = Game::get($id_game);
     if ($game->num_players > 1) {
         $entries = Entry::getByTeamGame($id_game);
     } else {
         $entries = Entry::getBySoloGame($id_game);
     }
     return response()->json($entries);
 }
 function getOne($id_game, $mobile)
 {
     $game = Game::get($id_game);
     if ($game->num_players > 1) {
         $entries = Entry::getByTeamGame($id_game);
     } else {
         $entries = Entry::getBySoloGame($id_game);
     }
     return view($mobile . 'games.one', ['games' => $games, 'entries' => $entries]);
 }
Ejemplo n.º 11
0
 protected static function newItem($id, $name, $headers, $entries)
 {
     $item = Item::create(['section_id' => $id, 'name' => $name]);
     foreach ($headers as $header => $value) {
         ItemHeader::create(['item_id' => $item->id, 'name' => $header, 'value' => $value]);
     }
     foreach ($entries as $key => $entry) {
         Entry::create(['item_id' => $item->id, 'entry' => $entry, 'ordered' => $key]);
     }
 }
Ejemplo n.º 12
0
 /**
  * Create a new entry.
  * 
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $data = $request->all();
     $validator = \Validator::make($data, ['seconds' => 'required|numeric']);
     if ($validator->fails()) {
         return response()->json(['errors' => $validator->errors()->all()], 400);
     }
     $user = \Auth::user();
     $entry = Entry::create(['user_id' => (int) \Auth::user()->id, 'seconds' => (int) $data['seconds'], 'note' => !empty($data['note']) ? $data['note'] : null]);
     return response()->json($entry, 201);
 }
Ejemplo n.º 13
0
 /**
  * @todo this is f*****g gross
  */
 public function getCompletedAttribute()
 {
     if (\Auth::guest()) {
         return false;
     }
     $entry = Entry::where('goal_id', $this->id)->where('user_id', \Auth::user()->id)->where('completed_on', Carbon::today())->first();
     if ($entry) {
         return true;
     }
     return false;
 }
Ejemplo n.º 14
0
 public function update(Request $request, $id)
 {
     $entry = Entry::findOrFail($id);
     $user = JWTAuth::parseToken()->authenticate();
     if ($user->id == $entry->user_id) {
         $entry->update($request->all());
         return $entry;
     } else {
         abort(403, 'Not authorized to update this entry');
     }
 }
Ejemplo n.º 15
0
 function getOne($id_game)
 {
     $game = Game::get($id_game);
     if ($game->num_players > 1) {
         $entries = Entry::getByTeamGame($id_game);
     } else {
         $entries = Entry::getBySoloGame($id_game);
     }
     if (empty($entries)) {
         return view('light.empty', ['game' => $game]);
     }
     return view($game->num_players > 1 ? 'light.multi' : 'light.solo', ['game' => $game, 'entries' => $entries]);
 }
Ejemplo n.º 16
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // $this->call(UserTableSeeder::class);
     Model::unguard();
     DB::table('users')->delete();
     DB::table('admins')->delete();
     DB::table('employees')->delete();
     DB::table('entries')->delete();
     $users = array(['name' => 'Ryan Chenkie', 'email' => '*****@*****.**', 'password' => bcrypt('secret'), 'type' => 1], ['name' => 'Chris Sevilleja', 'email' => '*****@*****.**', 'password' => bcrypt('secret'), 'type' => 3], ['name' => 'Holly Lloyd', 'email' => '*****@*****.**', 'password' => bcrypt('secret'), 'type' => 2], ['name' => 'Adnan Kukic', 'email' => '*****@*****.**', 'password' => bcrypt('secret'), 'type' => 2]);
     // Loop through each user above and create the record for them in the database
     foreach ($users as $user) {
         User::create($user);
     }
     Employee::create(['type' => 1, 'user_id' => 3]);
     Employee::create(['type' => 2, 'user_id' => 4]);
     Admin::create(['type' => 1, 'user_id' => 1]);
     Entry::create(['timeIn' => Carbon::now(), 'user_id' => 2]);
     Model::reguard();
 }
Ejemplo n.º 17
0
    public function get()
    {
        $entry_id = Request::input('entry_id');
        $entry = Entry::where('id', '=', $entry_id)->first();
        if ($entry) {
            $my_teams = array();
            $global_moderator = false;
            $team_moderator = false;
            $entry_user = $entry->user()->first();
            $user = NULL;
            if (!Auth::check()) {
                if (!$entry->public) {
                    return json_encode(['status' => 'error', 'message' => 'Error. Logout and try again']);
                }
            } else {
                $entry_teams = $entry->teams()->get();
                $user = Auth::user();
                foreach ($entry_teams as $team) {
                    if ($entry->user_id == $user->id || !$team->pivot->removed_from_team) {
                        $check = $team->users()->where('user_id', '=', $user->id)->first();
                        if ($check) {
                            $role = $check->pivot->role;
                            $my_teams[] = ["name" => $team->name, "role" => $role];
                            if ($role && ($role == 'owner' || $role == 'moderator')) {
                                $team_moderator = true;
                            }
                        }
                    }
                }
                if (!$entry->public && !count($my_teams) && $entry->user_id != $user->id) {
                    return json_encode(['status' => 'error', 'message' => 'Error. Logout and try again']);
                }
                if ($entry->public && $user->moderator) {
                    $global_moderator = true;
                }
            }
            $body_rendered = $entry->body_rendered;
            $body = '
            <!DOCTYPE html>
            <html lang="en">
                <head>
                    <title>".$entry->title."</title>
                    <meta charset="utf-8" />
                    <meta name="viewport" content="width=device-width, initial-scale=1">
                    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
                    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
                    <style>
                        code {
                            color: black;
                            background-color: #f5f5f5;
                            border-radius: 4px;
                            border: 1px solid #ccc;
                            padding: 1px 5px;
                        }
                        pre code {
                            border: none;
                        }

                        /* Pygmentize theme: Friendly */
                        .highlight .hll { background-color: #ffffcc }
                        .highlight .c { color: #60a0b0; font-style: italic } /* Comment */
                        .highlight .err { border: 1px solid #FF0000 } /* Error */
                        .highlight .k { color: #007020; font-weight: bold } /* Keyword */
                        .highlight .o { color: #666666 } /* Operator */
                        .highlight .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline */
                        .highlight .cp { color: #007020 } /* Comment.Preproc */
                        .highlight .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */
                        .highlight .cs { color: #60a0b0; background-color: #fff0f0 } /* Comment.Special */
                        .highlight .gd { color: #A00000 } /* Generic.Deleted */
                        .highlight .ge { font-style: italic } /* Generic.Emph */
                        .highlight .gr { color: #FF0000 } /* Generic.Error */
                        .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
                        .highlight .gi { color: #00A000 } /* Generic.Inserted */
                        .highlight .go { color: #808080 } /* Generic.Output */
                        .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
                        .highlight .gs { font-weight: bold } /* Generic.Strong */
                        .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
                        .highlight .gt { color: #0040D0 } /* Generic.Traceback */
                        .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
                        .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
                        .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
                        .highlight .kp { color: #007020 } /* Keyword.Pseudo */
                        .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
                        .highlight .kt { color: #902000 } /* Keyword.Type */
                        .highlight .m { color: #40a070 } /* Literal.Number */
                        .highlight .s { color: #4070a0 } /* Literal.String */
                        .highlight .na { color: #4070a0 } /* Name.Attribute */
                        .highlight .nb { color: #007020 } /* Name.Builtin */
                        .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
                        .highlight .no { color: #60add5 } /* Name.Constant */
                        .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
                        .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
                        .highlight .ne { color: #007020 } /* Name.Exception */
                        .highlight .nf { color: #06287e } /* Name.Function */
                        .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
                        .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
                        .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
                        .highlight .nv { color: #bb60d5 } /* Name.Variable */
                        .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
                        .highlight .w { color: #bbbbbb } /* Text.Whitespace */
                        .highlight .mf { color: #40a070 } /* Literal.Number.Float */
                        .highlight .mh { color: #40a070 } /* Literal.Number.Hex */
                        .highlight .mi { color: #40a070 } /* Literal.Number.Integer */
                        .highlight .mo { color: #40a070 } /* Literal.Number.Oct */
                        .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
                        .highlight .sc { color: #4070a0 } /* Literal.String.Char */
                        .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
                        .highlight .s2 { color: #4070a0 } /* Literal.String.Double */
                        .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
                        .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
                        .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
                        .highlight .sx { color: #c65d09 } /* Literal.String.Other */
                        .highlight .sr { color: #235388 } /* Literal.String.Regex */
                        .highlight .s1 { color: #4070a0 } /* Literal.String.Single */
                        .highlight .ss { color: #517918 } /* Literal.String.Symbol */
                        .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
                        .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
                        .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
                        .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
                        .highlight .il { color: #40a070 } /* Literal.Number.Integer.Long */


                        html, body {
                            background-color:transparent;
                        }
                        h1 {
                            font-size:24px;
                        }
                        h2 {
                            font-size:22px;
                        }
                        h3 {
                            font-size:20px;
                        }
                        h4 {
                            font-size:18px;
                        }
                        h5 {
                            font-size:16px;
                        }
                        h6 {
                            font-size:14px;
                        }

                        h2.title {
                            padding-bottom:0px;
                            margin-bottom:2px;
                            margin-top:12px;
                        }

                        p.description {
                            padding-bottom:2px;
                            margin-top:3px;
                        }

                        .vote {
                            float:left;
                            width:48px;
                            text-align: center;
                            height:64px;
                            margin-left:-10px;
                            margin-top:1px;
                        }

                        .score {
                            line-height:12px;
                            font-size:18px;
                            padding-top: 1px;
                            margin-left:2px;
                        }

                        .arrow-up {
                            padding-top:9px;
                            cursor: pointer;
                        }
                        .arrow-down {
                            padding-top:3px;
                            cursor: pointer;
                        }
                        .arrow-up.voted {
                            color:green;
                        }
                        .arrow-down.voted {
                            color:red;
                        }
                        .noselect {
                            -webkit-touch-callout: none;
                            -webkit-user-select: none;
                            user-select:none;
                        }
                        .actions {
                            padding: 1px 4px;
                            font-size: 90%;
                            vertical-align:1px;
                            cursor: pointer;
                            white-space:nowrap;
                            box-shadow:none;
                            font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
                        }
                        .actions.edit {
                            background-color:#286090;
                        }
                        .actions.delete {
                            background-color:#c9302c;
                        }
                        .dash-internal {
                            color: inherit !important;
                            text-decoration: none !important;
                        }

                    </style>
                </head>
                <body>
                    <div class="container-fluid">';
            if ($entry->public || count($my_teams)) {
                $voted_up = "";
                $voted_down = "";
                if ($user) {
                    $vote = Vote::where('user_id', '=', $user->id)->where('entry_id', '=', $entry->id)->first();
                    if ($vote) {
                        $voted_up = $vote->type == 1 ? "voted" : "";
                        $voted_down = $vote->type == -1 ? "voted" : "";
                    }
                }
                $score = $entry->score > 999 ? 999 : $entry->score;
                $score = $score < -999 ? -999 : $score;
                $body .= '
                    <div class="vote noselect">
                        <a class="dash-internal" href="#dashInternalVoteUp"><div class="arrow-up glyphicon glyphicon-arrow-up ' . $voted_up . '"></div></a>
                        <div class="score">' . $score . '</div>
                        <a class="dash-internal" href="#dashInternalVoteDown"><div class="arrow-down glyphicon glyphicon-arrow-down ' . $voted_down . '"></div></a>
                    </div>';
            }
            $body .= '
                    <div><h2 class="title">' . htmlentities($entry->title, ENT_QUOTES) . '</h2>
                    <p class="description"><small>';
            $body .= $entry->public && !($entry->removed_from_public && $global_moderator) ? "Public annotation " : @"Private annotation ";
            $body .= 'by <u>' . htmlentities($entry_user->username, ENT_QUOTES) . '</u>';
            $team_string = "";
            $i = 0;
            foreach ($my_teams as $team) {
                ++$i;
                if (strlen($team_string)) {
                    $team_string .= count($my_teams) == $i ? " and " : ", ";
                }
                $team_string .= '<u>' . htmlentities($team['name'], ENT_QUOTES) . '</u>';
            }
            if (strlen($team_string)) {
                $body .= ' in ' . $team_string . '';
            }
            $body .= ' ';
            if ($user && $user->id == $entry->user_id) {
                $body .= '&nbsp;<a class="dash-internal" href="#dashInternalEdit"><kbd class="actions edit">Edit</kbd></a>';
                $body .= '&nbsp;<a class="dash-internal" href="#dashInternalDelete"><kbd class="actions delete">Delete</kbd></a>';
            } else {
                if ($global_moderator && $entry->public && !$entry->removed_from_public) {
                    $body .= '&nbsp;<a class="dash-internal" href="#dashInternalRemoveFromPublic"><kbd class="actions delete">Remove From Public</kbd></a>';
                }
                if ($team_moderator) {
                    $body .= '&nbsp;<a class="dash-internal" href="#dashInternalRemoveFromTeams"><kbd class="actions delete">Remove From Team';
                    if (count($my_teams) > 1) {
                        $body .= 's';
                    }
                    $body .= '</kbd></a>';
                }
            }
            $body .= '</small><p></div>
                    <p>' . $body_rendered . '</P>
                    </div>
                </body>
            </html>';
            return ["status" => "success", "body" => $entry->body, "body_rendered" => $body, "teams" => $my_teams, "global_moderator" => $global_moderator];
        }
        return json_encode(['status' => 'error', 'message' => 'Error. Logout and try again']);
    }
Ejemplo n.º 18
0
<?php

/**
 * 
 */
use App\User;
use App\Entry;
use App\Comment;
// The following routes serve the nav bar
////////////////////////////////////////
// Default route ... to the Blog!
Route::get('/', function () {
    // Get all the entries
    $entries = Entry::all()->sortByDesc(function ($entry) {
        return $entry->updated_at;
    });
    // Return the view rendered with all the entries
    return view('blog', ['entries' => $entries]);
});
// About route...
Route::get('about', function () {
    return view('about');
});
// Authentication routes...
// Login...
Route::get('/auth/login', 'Auth\\AuthController@getLogin');
Route::post('/auth/login', 'Auth\\AuthController@postLogin');
// Logout...
Route::get('/auth/logout', 'Auth\\AuthController@getLogout');
// TOD Registration routes...
//Route::get('/auth/register', 'Auth\AuthController@getRegister');
Ejemplo n.º 19
0
 public function postFormIndex(CreateEntryRequest $request)
 {
     $input = $request->all();
     Entry::create($input);
     return response()->json(['status' => 'OK', 'message' => 'Formul nu a fost completat']);
 }
Ejemplo n.º 20
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // Delete the database entry
     $entry = Entry::findOrFail($id);
     $entry->delete();
     $params = ['title' => 'Destroyed Blog Entry!', 'entry' => $entry];
     return view('blog.entry.destroy', $params);
 }
 function verify($id_entry, Request $req, $crpt_pass)
 {
     $vld = Validator::make(['id' => $id_entry, 'password' => $req->input('password'), 'crpt' => $crpt_pass], ['id' => 'required|numeric', 'password' => 'required_without:crpt', 'crpt' => 'required_without:password']);
     if ($vld->fails()) {
         if ($req->is('light/*')) {
             if (!empty($crpt_pass)) {
                 return redirect('light')->with('message', 'Lien erroné.');
             }
             return redirect()->back()->with('errors', $vld->messages()->all());
         }
         return response()->json($vld->messages()->all(), 400);
     }
     $id_game = $req->input('id_game');
     $password = empty($crpt_pass) ? $req->input('password') : Crypt::decrypt($crpt_pass);
     if (Entry::approve($id_entry, $password) > 0) {
         if ($req->is('light/*')) {
             return redirect('/')->with('message', 'Entrée confirmée.');
         } else {
             return response()->json("success");
         }
     }
     if ($req->is('light/*')) {
         if (!empty($crpt_pass)) {
             return redirect('light')->with('message', 'Lien erroné.');
         }
         return redirect()->back()->with('errors', ["Mot de passe non valide."]);
     }
     return response()->json("Mot de passe non valide.");
 }
 public function testDummy()
 {
     factory(\App\Entry::class, 5)->create();
     $this->assertEquals(5, \App\Entry::all()->count());
 }
Ejemplo n.º 23
0
 private function getLeaderboardSince(Carbon $date)
 {
     $stats = Entry::select('users.name as name', DB::raw('sum(goals.points) as points'))->where('completed_on', '>=', $date)->join('users', 'users.id', '=', 'entries.user_id')->join('goals', 'goals.id', '=', 'entries.goal_id')->groupBy('entries.user_id')->orderBy('points', 'desc')->limit(5)->get();
     return $stats;
 }
Ejemplo n.º 24
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
use App\Entry;
Route::get('/', function () {
    return view('welcome');
});
Route::group(['prefix' => 'api', 'after' => 'CORS'], function () {
    Route::get('test', function () {
        $entries = Entry::with('locations')->with('participants')->with('tags')->with('days')->with('hours')->get();
        return $entries->toJson();
    });
    Route::get('get-by-rating', 'FrontController@getByHighestRating');
    Route::get('get-by-id/{id}', 'FrontController@getById');
    Route::get('get-by-date', 'FrontController@getByCreatedAt');
    Route::get('search', 'FrontController@search');
    Route::get('/bot/update', 'BotController@getUpdates');
});
Ejemplo n.º 25
0
 /**
  * Get any refunds/cancellations that are currently pending. These are entries
  * where 'paymentStatus' == 'pending_cancellation_single|pending_cancellation_event'.
  */
 private function getRefundsPending()
 {
     $cancellations = Entry::where('paymentStatus', '=', 'pending_cancellation_single')->orWhere('paymentStatus', '=', 'pending_cancellation_event')->get();
     return $cancellations;
 }
Ejemplo n.º 26
0
 public function removeEntry()
 {
     $entryId = Request::get('entryId');
     $entry = Entry::find($entryId);
     $entry->delete();
 }
Ejemplo n.º 27
0
 /**
  * Mark a cancelled entry as cancelled (i.e. refunded) in the database
  */
 public function entryRefunded(Request $request, $entry_id)
 {
     $entry = Entry::findOrFail($entry_id);
     $entry->paymentStatus = 'cancelled';
     $entry->save();
     return redirect(action('EventsController@siteAdmin'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Entry::destroy($id);
     return redirect('entries');
 }
Ejemplo n.º 29
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($slug)
 {
     $entry = Entry::where('slug', $slug)->first();
     return view('thoughts.show', compact('entry'));
 }