Skip to content

Commit

Permalink
Merge pull request #21 from biigle/laravel-9
Browse files Browse the repository at this point in the history
Upgrade to Laravel 9
  • Loading branch information
mzur authored Feb 21, 2022
2 parents 5ad7552 + 88fa7ff commit 9c591fa
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 30 deletions.
16 changes: 0 additions & 16 deletions src/AnanasServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Biigle\Http\Requests\UpdateUserSettings;
use Biigle\Modules\Ananas\Observers\AnnotationAssistanceRequestObserver;
use Biigle\Services\Modules;
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
Expand Down Expand Up @@ -71,10 +70,6 @@ public function register()
});

$this->commands('command.ananas.publish');

if (config('app.env') === 'testing') {
$this->registerEloquentFactoriesFrom(__DIR__.'/database/factories');
}
}

/**
Expand All @@ -88,15 +83,4 @@ public function provides()
'command.ananas.publish',
];
}

/**
* Register factories.
*
* @param string $path
* @return void
*/
protected function registerEloquentFactoriesFrom($path)
{
$this->app->make(EloquentFactory::class)->load($path);
}
}
14 changes: 14 additions & 0 deletions src/AnnotationAssistanceRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace Biigle\Modules\Ananas;

use Biigle\ImageAnnotation;
use Biigle\Modules\Ananas\Database\Factories\AnnotationAssistanceRequestFactory;
use Biigle\User;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;

Expand All @@ -13,6 +15,8 @@
*/
class AnnotationAssistanceRequest extends Model
{
use HasFactory;

/**
* The attributes that should be casted to native types.
*
Expand Down Expand Up @@ -87,4 +91,14 @@ public function getResponseLabelAttribute()

return;
}

/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return AnnotationAssistanceRequestFactory::new();
}
}
33 changes: 33 additions & 0 deletions src/Database/Factories/AnnotationAssistanceRequestFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Biigle\Modules\Ananas\Database\Factories;

use Biigle\ImageAnnotation;
use Biigle\Modules\Ananas\AnnotationAssistanceRequest;
use Biigle\User;
use Illuminate\Database\Eloquent\Factories\Factory;

class AnnotationAssistanceRequestFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = AnnotationAssistanceRequest::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'token' => $this->faker->sha256,
'request_text' => $this->faker->text,
'annotation_id' => ImageAnnotation::factory(),
'user_id' => User::factory(),
];
}
}
14 changes: 0 additions & 14 deletions src/database/factories/ModelFactory.php

This file was deleted.

0 comments on commit 9c591fa

Please sign in to comment.