Move Models into app/Models

This commit is contained in:
Jérémy Munsch 2022-03-08 11:40:52 +01:00
parent 09d3d0fee2
commit e5cae87c04
No known key found for this signature in database
GPG key ID: 55196BEE445F6049
12 changed files with 51 additions and 31 deletions

View file

@ -1,15 +0,0 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Aliments extends Model
{
public $timestamps = false;
/**
* @var string
*/
protected $table = 'aliments';
}

View file

@ -3,7 +3,7 @@
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Moba;
use App\Models\Moba;
use Carbon\Carbon;
class ImportMoba extends Command

View file

@ -3,7 +3,7 @@
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Moba;
use App\Models\Moba;
class MajEleveurs extends Command
{

View file

@ -3,10 +3,10 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\MiseEnPlace;
use App\Aliments;
use App\Eleveur;
use App\Moba;
use App\Models\MiseEnPlace;
use App\Models\Aliment;
use App\Models\Eleveur;
use App\Models\Moba;
use Carbon\Carbon;
class AjaxController extends Controller
@ -33,7 +33,7 @@ class AjaxController extends Controller
$date = $y . '-' . $m . '-' . $d;
$aliment = $data[2];
$alim = new Aliments();
$alim = new Aliment();
$alim->code_lot = $codeLot;
$alim->date_livraison = $date;
$alim->type_aliment = $aliment;

View file

@ -2,7 +2,7 @@
namespace App\Http\Controllers;
use App\Eleveur;
use App\Models\Eleveur;
use App\Http\Requests\MyRequest;
use Response;

View file

@ -2,10 +2,10 @@
namespace App\Http\Controllers;
use App\Eleveur;
use App\Aliments;
use App\MiseEnPlace;
use App\Moba;
use App\Models\Eleveur;
use App\Models\Aliment;
use App\Models\MiseEnPlace;
use App\Models\Moba;
use App\VisuelLibelle;
use Carbon\Carbon;
@ -54,7 +54,7 @@ class FrontController extends Controller
$mep = MiseEnPlace::whereIn('eleveurId_pondeuse', $elevId)->where('date_transfert_poulettes', '<', $datePonte)->orderBy('id', 'DESC')->first();
if ($mep) {
$aliment = Aliments::where('code_lot', $mep->code_lot_pondeuse)->orderBy('id', 'DESC')->first();
$aliment = Aliment::where('code_lot', $mep->code_lot_pondeuse)->orderBy('id', 'DESC')->first();
} else {
$mep = '';
$aliment = "";

15
app/Models/Aliments.php Normal file
View file

@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Aliment extends Model
{
/**
* Indicates if the model should be timestamped.
*
* @var boolean
*/
public $timestamps = false;
}

View file

@ -1,6 +1,6 @@
<?php
namespace App;
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
@ -9,6 +9,11 @@ class Eleveur extends Model
{
use SoftDeletes;
/**
* Indicates if the model should be timestamped.
*
* @var boolean
*/
public $timestamps = false;
/**
@ -44,9 +49,19 @@ class Eleveur extends Model
*/
protected $table = 'eleveurs';
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = ['questions'];
public function getQuestionsAttribute()
/**
* Questions attribute accessor
*
* @return boolean
*/
public function getQuestionsAttribute(): bool
{
if ($this->aboutyou != null && $this->aboutyou != '') {
return true;

View file

@ -1,11 +1,16 @@
<?php
namespace App;
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class MiseEnPlace extends Model
{
/**
* Indicates if the model should be timestamped.
*
* @var boolean
*/
public $timestamps = false;
/**