You've already forked isop-mirror
refactor: rename InternshipStatus model to InternshipStatusData
This commit is contained in:
@@ -5,7 +5,7 @@ namespace App\Http\Controllers;
|
|||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Internship;
|
use App\Models\Internship;
|
||||||
use App\Models\InternshipStatus;
|
use App\Models\InternshipStatusData;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ class CompanyController extends Controller
|
|||||||
|
|
||||||
// mazanie statusov
|
// mazanie statusov
|
||||||
$internships->each(function ($internship) {
|
$internships->each(function ($internship) {
|
||||||
InternshipStatus::whereInternshipId($internship->id)->delete();
|
InternshipStatusData::whereInternshipId($internship->id)->delete();
|
||||||
});
|
});
|
||||||
|
|
||||||
// mazanie praxov
|
// mazanie praxov
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Internship;
|
use App\Models\Internship;
|
||||||
use App\Models\InternshipStatus;
|
use App\Models\InternshipStatusData;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Mpdf\Mpdf;
|
use Mpdf\Mpdf;
|
||||||
@@ -185,7 +185,7 @@ class InternshipController extends Controller
|
|||||||
'agreement' => null
|
'agreement' => null
|
||||||
]);
|
]);
|
||||||
|
|
||||||
InternshipStatus::create([
|
InternshipStatusData::create([
|
||||||
'internship_id' => $Internship->id,
|
'internship_id' => $Internship->id,
|
||||||
'status' => 'SUBMITTED',
|
'status' => 'SUBMITTED',
|
||||||
'changed' => now(),
|
'changed' => now(),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Mail\InternshipStatusUpdated;
|
use App\Mail\InternshipStatusUpdated;
|
||||||
use App\Models\Internship;
|
use App\Models\Internship;
|
||||||
use App\Models\InternshipStatus;
|
use App\Models\InternshipStatusData;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Mail;
|
use Mail;
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ class InternshipStatusDataController extends Controller
|
|||||||
public function get(int $id)
|
public function get(int $id)
|
||||||
{
|
{
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$internship_statuses = InternshipStatus::whereInternshipId($id)->orderByDesc('changed')->get();
|
$internship_statuses = InternshipStatusData::whereInternshipId($id)->orderByDesc('changed')->get();
|
||||||
|
|
||||||
if (!$internship_statuses) {
|
if (!$internship_statuses) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -77,7 +77,7 @@ class InternshipStatusDataController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*/
|
*/
|
||||||
public function show(InternshipStatus $internshipStatus)
|
public function show(InternshipStatusData $internshipStatus)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ class InternshipStatusDataController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Show the form for editing the specified resource.
|
* Show the form for editing the specified resource.
|
||||||
*/
|
*/
|
||||||
public function edit(InternshipStatus $internshipStatus)
|
public function edit(InternshipStatusData $internshipStatus)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ class InternshipStatusDataController extends Controller
|
|||||||
'note' => ['required', 'string', 'min:1']
|
'note' => ['required', 'string', 'min:1']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
InternshipStatus::create([
|
InternshipStatusData::create([
|
||||||
'internship_id' => $id,
|
'internship_id' => $id,
|
||||||
'status' => $request->status,
|
'status' => $request->status,
|
||||||
'note' => $request->note,
|
'note' => $request->note,
|
||||||
@@ -132,7 +132,7 @@ class InternshipStatusDataController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*/
|
*/
|
||||||
public function destroy(InternshipStatus $internshipStatus)
|
public function destroy(InternshipStatusData $internshipStatus)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace App\Http\Controllers;
|
|||||||
use App\Models\Internship;
|
use App\Models\Internship;
|
||||||
use App\Models\StudentData;
|
use App\Models\StudentData;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\InternshipStatus;
|
use App\Models\InternshipStatusData;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ class StudentDataController extends Controller
|
|||||||
|
|
||||||
// mazanie statusov
|
// mazanie statusov
|
||||||
$internships->each(function ($internship) {
|
$internships->each(function ($internship) {
|
||||||
InternshipStatus::whereInternshipId($internship->id)->delete();
|
InternshipStatusData::whereInternshipId($internship->id)->delete();
|
||||||
});
|
});
|
||||||
|
|
||||||
// mazanie praxov
|
// mazanie praxov
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class Internship extends Model
|
|||||||
|
|
||||||
public function status()
|
public function status()
|
||||||
{
|
{
|
||||||
return $this->hasOne(InternshipStatus::class, 'internship_id')->latestOfMany();
|
return $this->hasOne(InternshipStatusData::class, 'internship_id')->latestOfMany();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace App\Models;
|
|||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class InternshipStatus extends Model
|
class InternshipStatusData extends Model
|
||||||
{
|
{
|
||||||
/** @use HasFactory<\Database\Factories\InternshipStatusFactory> */
|
/** @use HasFactory<\Database\Factories\InternshipStatusFactory> */
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
@@ -5,7 +5,7 @@ namespace Database\Factories;
|
|||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\InternshipStatus>
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\InternshipStatusData>
|
||||||
*/
|
*/
|
||||||
class InternshipStatusFactory extends Factory
|
class InternshipStatusFactory extends Factory
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace Database\Seeders;
|
|||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Internship;
|
use App\Models\Internship;
|
||||||
use App\Models\InternshipStatus;
|
use App\Models\InternshipStatusData;
|
||||||
use App\Models\StudentData;
|
use App\Models\StudentData;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
@@ -57,7 +57,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
'company_id' => Company::inRandomOrder()->value('id'),
|
'company_id' => Company::inRandomOrder()->value('id'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
InternshipStatus::factory()->create([
|
InternshipStatusData::factory()->create([
|
||||||
'internship_id' => $internship->id,
|
'internship_id' => $internship->id,
|
||||||
'status' => "SUBMITTED",
|
'status' => "SUBMITTED",
|
||||||
'note' => 'made by seeder',
|
'note' => 'made by seeder',
|
||||||
|
|||||||
Reference in New Issue
Block a user