public function getNext($id)
 {
     // TODO: Delete unused 'count'
     $userid = $this->auth->user()->id;
     $batchId = $this->auth->user()->batch_id;
     $batch = \App\Batch::find($batchId);
     if ($batch == null) {
         \DebugBar::warning('$batch==null:');
         $batch = $this->newBatch($id, $userid);
         $this->auth->user()->batch_id = $batch->id;
         $this->auth->user()->save();
     } elseif ($batch->remain_count == 0) {
         \DebugBar::warning('$batch->remain_count == 0');
         $standard = \App\StandardItem::find($batch->standard_item_id);
         // if user owns no valid batch or he/she has already done a batch
         $batch = $this->newBatch($id, $userid);
         if ($batch == null) {
             return view('tag.no_more', ['user' => $this->auth->user(), 'dataset' => \App\Dataset::find($id)]);
         }
         $this->auth->user()->batch_id = $batch->id;
         $this->auth->user()->save();
         return view('tag.done', ['user' => $this->auth->user(), 'dataset' => \App\Dataset::find($id), 'standard' => $standard]);
     }
     $standard = \App\StandardItem::find($batch->standard_item_id);
     $items = $standard->Items;
     $item = $items[$batch->remain_count - 1];
     return view('tag.tag', ['user' => $this->auth->user(), 'dataset' => \App\Dataset::find($id), 'standard' => $standard, 'batch' => $batch, 'item' => $item]);
 }
Пример #2
0
|--------------------------------------------------------------------------
| 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.
|
*/
Route::get('/', function () {
    print_r("Hello!");
    $debug_var = ["1", "2", ["3"]];
    var_dump($debug_var);
    DebugBar::info($debug_var);
    DebugBar::error('Error!');
    DebugBar::warning('Watch out…');
    DebugBar::addMessage('Another message', 'mylabel');
    return view('app.index');
});
Route::group(['middleware' => ['auth', 'guest']], function () {
    Route::get('user/profile', function () {
        // Uses Auth Middleware
    });
});
Route::get('/dashboard', function (Request $request) {
    if (Auth::user()) {
        return view('app.dashboard')->with('title', 'Dashboard');
    } else {
        $request->session()->flash('message', 'please login first');
        return redirect("auth/login");
    }