PHP code example of erdikoroglu / laravel-service-scaffold
1. Go to this page and download the library: Download erdikoroglu/laravel-service-scaffold library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
erdikoroglu / laravel-service-scaffold example snippets
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('tests', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->softDeletes(); // Eğer seçildiyse
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('tests');
}
};
use App\Services\TestService;
class TestController extends Controller
{
public function store(TestStoreRequest $request, TestService $service)
{
return $service->create($request->validated());
}
public function update(TestUpdateRequest $request, Test $test, TestService $service)
{
return $service->update($test, $request->validated());
}
// Search, delete, restore vb. için benzer
}
public function create(array $data): Test
{
return $this->repository->create($data);
}
bash
php artisan make:service Test
INFO Model [app/Models/Test/Test.php] created successfully.
INFO Factory [database/factories/Test/TestFactory.php] created successfully.
INFO Migration [database/migrations/2025_11_03_185741_create_tests_table.php] created successfully.
✅ Model ve migration oluşturuldu: Test
🧩 Migration güncellendi: 2025_11_03_185741_create_tests_table.php
🕊️ SoftDeletes trait eklendi: Models/Test/Test.php
🛡️ Model fillable alanları eklendi: Models/Test/Test.php
📘 Interface oluşturuldu: TestInterface
🧩 Repository oluşturuldu: TestRepository
⚙️ Service oluşturuldu: TestService
📝 Request oluşturuldu: TestStoreRequest
... (diğer Request'ler)
🔗 AppServiceProvider'a binding eklendi
🎉 Tüm Test sınıfları başarıyla oluşturuldu!
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.