Skip to content

Commit

Permalink
stub
Browse files Browse the repository at this point in the history
  • Loading branch information
zalsader committed Sep 11, 2015
1 parent 2859c32 commit 9ee2415
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/QuestionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function store(Request $request)
*/
public function show($id)
{
$question = Question::findOrFail($id);
$question = Question::activated()->findOrFail($id);
$observation = $question->observations()
->where('user_id', '=', \Request::user()->id)
->firstOrCreate(['user_id'=>\Request::user()->id]);
Expand Down
9 changes: 9 additions & 0 deletions app/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,13 @@ public function submissions() {
public function observations() {
return $this->hasMany('\App\QuestionObservation');
}

public function scopeActivated($q) {
return $q->where('active', '=', true)
->whereExists(function ($query) {
$query->select(\DB::raw(1))
->from('levels')
->whereRaw('levels.id = questions.level_id');
});
}
}
2 changes: 1 addition & 1 deletion app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class User extends Model implements AuthenticatableContract,
* @var array
*/
protected $fillable = ['name', 'email', 'password'];

/**
* The attributes excluded from the model's JSON form.
*
Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
|
*/

'timezone' => 'UTC',
'timezone' => 'UTC+3',

/*
|--------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function up()
$table->text('hint_text')->nullable();
$table->string('hint_image')->nullable();
$table->double('hint_penalty', 15, 8)->nullable();
$table->boolean('active')->default(1);
$table->timestamps();
});
}
Expand Down
8 changes: 5 additions & 3 deletions resources/views/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@
<div class="row">
<div class="col-md-2" style="margin-left:40px">
<div style="margin-top:20px">
<a href="https://www.facebook.com/ieeenajah"><img src="{{asset('images/SBLogo.png')}}" width="100px" class=""></a>
<a href="https://www.facebook.com/ieeenajah"><img src="{{url('images/SBLogo.png')}}" width="100px" class=""></a>
</div>
<div style="margin-top:20px">
<a href="https://www.facebook.com/ieeenajah"><img src="{{asset('images/cs.jpg')}}" width="100px"></a>
<a href="https://www.facebook.com/ieeenajah"><img src="{{url('images/cs.jpg')}}" width="100px"></a>
</div>
</div>
<div class="col-md-2 col-md-offset-2">
<a href="{{url('/')}}"><img src="{{asset('images/TLAP.jpg')}}" width="350px"></a>
<a href="{{url('/')}}"><img src="{{url('images/TLAP.jpg')}}" width="350px"></a>
</div>
<div class="col-md-2 col-md-offset-3">
<br>
<br>
<h4>Welcome {{\Auth::user()->name}}!</h4>
<a href="{{url('logout')}}" class="btn btn-danger">log out</a>
</div>
Expand Down

0 comments on commit 9ee2415

Please sign in to comment.