/** * Run the migrations. * * @return void */ public function up() { Schema::dropIfExists('users'); Schema::dropIfExists('password_resets'); Schema::dropIfExists('roles'); Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('first_name'); $table->string('last_name'); $table->integer('file_cover_id'); $table->string('email')->unique(); $table->string('password', 60); $table->string('login')->unique(); $table->tinyInteger('role_id')->unsigned()->default(0); $table->rememberToken(); $table->timestamps(); }); Schema::create('password_resets', function (Blueprint $table) { $table->string('email')->index(); $table->string('token')->index(); $table->timestamp('created_at'); }); Schema::create("roles", function (Blueprint $table) { $table->increments('id'); $table->string('name')->unique(); $table->tinyInteger('is_admin')->default(0)->unsigned(); $table->tinyInteger('status')->default(1)->unsigned(); }); Role::create(['id' => 1, 'name' => "User"]); Role::create(['id' => 2, 'name' => "Moderator", 'is_admin' => 1]); Role::create(['id' => 3, 'name' => "Admin", 'is_admin' => 1]); User::create(['email' => '*****@*****.**', 'login' => 'Vergo', 'first_name' => 'God', "last_name" => 'Admin', "password" => '1q2w3e4r', "role" => 3]); }
public function getUserById($userId) { $result = User::whereId($userId)->first(); return $result; }
public function ReportDetalils(Request $request, $report_id) { if ($request->isMethod('post')) { $reviewData['review_title'] = $request->input('title'); $reviewData['review_text'] = $request->input('comment'); $reviewData['report_id'] = $report_id; $data = $request->session()->all(); $userId = $data['ror_user']['id']; $reviewData['user_id'] = $userId; $reviewData['status'] = 1; $objuser = new User(); $resultuser = $objuser->getUserDetailsById($userId); $reviewData['full_name'] = $resultuser->full_name; $objreview = new Review(); $objresult = $objreview->createReview($reviewData); } $objgetreviewData = new Review(); $resultreviewData = $objgetreviewData->getReviewById($report_id); $getreviewCount = new Review(); $resultreviewcount = $getreviewCount->getReviewCount($report_id); $totalresultreviewcount = count($resultreviewcount); $objReportdataByName = new Report(); $TotalReportresult = $objReportdataByName->GetReportDetails($report_id); $report_id = $TotalReportresult[0]->report_id; $objReportFile = new Report(); $result = $objReportFile->getMediaFiles($report_id); return view('User.Views.user.report_details', ['TotalReportresult' => $TotalReportresult, 'result' => $result, 'resultreviewData' => $resultreviewData, 'totalresultreviewcount' => $totalresultreviewcount]); }