Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions app/Http/Controllers/InterviewQuestionsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Models\InterviewQuestion;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class InterviewQuestionsController extends Controller
{
/**
* Display a listing of the interview questions.
*
* @return \Illuminate\View\View
*/
public function index()
{
$userId = Auth::id();
$questions = InterviewQuestion::where('user_id', $userId)
->latest()
->paginate(10);

$hasQuestions = $questions->count() > 0;

return view('Users.Pages.interviewQuestions.index', compact('questions', 'hasQuestions'));

// return view('Users.Pages.interviewQuestions.interviewQuestions');
}
}
16 changes: 16 additions & 0 deletions app/Models/InterviewQuestion.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class InterviewQuestion extends Model
{
protected $fillable = [
'user_id',
'question',
'answer',
'level',
'category',
];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('interview_questions', function (Blueprint $table) {
$table->id();

$table->foreignId('user_id')
->constrained()
->cascadeOnDelete();

$table->text('question');

$table->longText('answer')->nullable();

$table->enum('level', ['junior', 'mid', 'senior'])
->default('junior');

$table->string('category', 100)
->nullable()
->index();

$table->timestamps();

// Optional but useful indexes
$table->index('level');
$table->index(['user_id', 'category']);
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('interview_questions');
}
};
113 changes: 113 additions & 0 deletions resources/css/pages/interview-questions.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/* ============================
Interview Questions Page
============================ */

/* Card Styling */
.question-card {
transition: all 0.3s ease;
border-left: 4px solid transparent;
}

.question-card:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
border-left-color: #0d6efd;
}

/* Question Title */
.question-title {
font-weight: 600;
color: #495057;
line-height: 1.4;
}

/* Meta Information */
.question-meta {
font-size: 0.85rem;
color: #6c757d;
display: flex;
align-items: center;
gap: 0.5rem;
}

/* Difficulty Badge */
.question-level {
font-size: 0.7rem;
padding: 0.25rem 0.5rem;
border-radius: 0.375rem;
font-weight: 600;
text-transform: uppercase;
}

.level-junior {
background: #e7f1ff;
color: #084298;
border: 1px solid #b6d4fe;
}

.level-mid {
background: #fff3cd;
color: #664d03;
border: 1px solid #ffecb5;
}

.level-senior {
background: #f8d7da;
color: #842029;
border: 1px solid #f5c2c7;
}

/* Action Buttons */
.question-actions .btn {
padding: 0.25rem 0.45rem;
display: flex;
align-items: center;
justify-content: center;
}

.question-actions .btn i {
width: 14px;
height: 14px;
}

/* Empty State */
.empty-state {
text-align: center;
padding: 3rem 1rem;
color: #6c757d;
}

.empty-state i {
width: 56px;
height: 56px;
margin-bottom: 1rem;
opacity: 0.6;
}

/* Header Section */
.page-header h1 {
font-weight: 600;
}

.page-header p {
margin-bottom: 0;
color: #6c757d;
}

/* Pagination Alignment */
.pagination {
margin-top: 1.5rem;
}

/* Responsive Tweaks */
@media (max-width: 768px) {
.question-meta {
flex-direction: column;
align-items: flex-start;
gap: 0.25rem;
}

.question-actions {
margin-top: 0.5rem;
}
}
Empty file.
113 changes: 113 additions & 0 deletions resources/views/Users/Pages/interviewQuestions/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
@extends('Users.Layouts.app')

@section('title', 'About | ' . Auth::user()->name)

@push('styles')
<link rel="stylesheet" href="{{ asset('css/pages/interview-questions.css') }}">
@endpush

@section('content')
<div class="container-fluid p-0">

{{-- Header --}}
<div class="mb-3 d-flex justify-content-between align-items-center">
<div>
<h1 class="h3 d-inline align-middle">
My Interview Questions
<span class="badge bg-warning text-dark ms-2">Coming Soon</span>
</h1>
<p class="text-muted mb-0">
Manage your personal interview question bank
</p>
</div>

{{-- <a href="{{ route('interviewQuestions.create') }}" class="btn btn-primary">
<i data-feather="plus" class="feather-sm me-1"></i>
Add New Question
</a> --}}
<button class="btn btn-primary" disabled>
<i data-feather="plus" class="feather-sm me-1"></i>
Add New Question
</button>
</div>

{{-- Question List --}}
@if($hasQuestions)
<div class="row">
@foreach($questions as $question)
<div class="col-12 col-md-6 mb-3">
<div class="card h-100 position-relative">
<div class="card-body">

{{-- Question Title --}}
<h6 class="mb-2">
{{ $question->title }}
</h6>

{{-- Meta --}}
<div class="text-muted small mb-2">
<i data-feather="calendar" class="feather-sm me-1"></i>
Added {{ $question->created_at->diffForHumans() }}

@if($question->level)
· <span class="badge bg-secondary">{{ ucfirst($question->level) }}</span>
@endif
</div>

{{-- Actions --}}
<div class="d-flex justify-content-end gap-2">
<a href="{{ route('interview-questions.show', $question->id) }}"
class="btn btn-sm btn-outline-primary"
title="View">
<i data-feather="eye"></i>
</a>

<a href="{{ route('interview-questions.edit', $question->id) }}"
class="btn btn-sm btn-outline-warning"
title="Edit">
<i data-feather="edit"></i>
</a>

<form action="{{ route('interview-questions.destroy', $question->id) }}"
method="POST"
class="delete-form">
@csrf
@method('DELETE')
<button class="btn btn-sm btn-outline-danger" title="Delete">
<i data-feather="trash-2"></i>
</button>
</form>
</div>

</div>
</div>
</div>
@endforeach
</div>

{{-- Pagination --}}
<div class="d-flex justify-content-center">
{{ $questions->links() }}
</div>
@else
{{-- Empty State --}}
<div class="card">
<div class="card-body text-center py-5 text-muted">
<i data-feather="help-circle" style="width:48px;height:48px;"></i>
<h5 class="mt-3">No Interview Questions Yet</h5>
<p>Create your first interview question to start building your library.</p>

{{-- <a href="{{ route('interviewQuestions.create') }}" class="btn btn-primary">
<i data-feather="plus" class="feather-sm me-1"></i>
Add New Question
</a> --}}
<button class="btn btn-primary" disabled>
<i data-feather="plus" class="feather-sm me-1"></i>
Add New Question
</button>
</div>
</div>
@endif

</div>
@endsection
7 changes: 7 additions & 0 deletions resources/views/Users/Partials/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@
</a>
</li>

<li class="sidebar-item {{ request()->routeIs('interviewQuestions.*') ? 'active' : '' }}">
<a class="sidebar-link" href="{{ route('interviewQuestions.index') }}">
<i class="align-middle" data-feather="clipboard"></i>
<span class="align-middle">My Interview Questions</span>
</a>
</li>

<li class="sidebar-header">
Settings
</li>
Expand Down
10 changes: 10 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@
Route::get('/{slug}/toggle-featured', [BlogController::class, 'toggleFeatured'])->name('toggle-featured');
});

// Interview Questions Routes
Route::prefix('interview-questions')->name('interviewQuestions.')->group(function () {
Route::get('/', [\App\Http\Controllers\InterviewQuestionsController::class, 'index'])->name('index');
Route::get('/create', [\App\Http\Controllers\InterviewQuestionsController::class, 'create'])->name('create');
// Route::post('/', [\App\Http\Controllers\InterviewQuestionsController::class, 'store'])->name('store');
// Route::get('/{id}/edit', [\App\Http\Controllers\InterviewQuestionsController::class, 'edit'])->name('edit');
// Route::put('/{id}', [\App\Http\Controllers\InterviewQuestionsController::class, 'update'])->name('update');
// Route::delete('/{id}', [\App\Http\Controllers\InterviewQuestionsController::class, 'destroy'])->name('destroy');
});

});

// Admin Routes
Expand Down