Skip to content
Snippets Groups Projects
Commit 7dc38823 authored by VONDERSCHER William's avatar VONDERSCHER William
Browse files

ajout de la rpeparation de la seance 2

parent 29e33024
No related branches found
No related tags found
No related merge requests found
{
"require":{
"illuminate/database": "5.5.*",
"php": ">=7.0"
},
"autoload":{
"psr-4": {
"prep\\" : "src/"
}
}
}
This diff is collapsed.
<?php
require 'vendor/autoload.php';
use Illuminate\Database\Capsule\Manager as DB;
use prep\models\annonce;
use prep\models\photo;
use prep\models\categorie;
$db = new DB();
$un = photo::where('ida', '=', 22)->get();
$deux = photo::where('ida', '=', 22)->where('taille_octet', '>', 100000)->get();
$quatre = annonce::photo()->where('taille_octet', '>', 100000)->get();
$ajoutphoto = new photo;
$ajoutphoto->file='test';
$ajoutphoto->date=date('Y/m/d');
$ajoutphoto->taille_octet=1000000;
$ajoutphoto->save();
<?php
namespace prep\models;
class annonce extends \Illuminate\Database\Eloquent\Model {
protected $table = 'annonce';
protected $primaryKey = 'id';
public $timestamps = false;
public function categorie(){
$s = 'id_cat';
return $this->belongsToMany('\mywishlist\models\categorie', $s);
}
public function photo(){
$s = 'idannonce';
return $this->hasmany('\mywishlist\models\photo', $s);
}
}
<?php
namespace prep\models;
class categorie extends \Illuminate\Database\Eloquent\Model {
protected $table = 'categorie';
protected $primaryKey = 'id';
public $timestamps = false;
public function annonce(){
$s = 'id_cat';
return $this->hasmany('\mywishlist\models\photo', $s);
}
}
<?php
namespace prep\models;
class photo extends \Illuminate\Database\Eloquent\Model {
protected $table = 'annonce';
protected $primaryKey = 'id';
public $timestamps = false;
public function categorie(){
$s = 'idannonce';
return $this->belongsTo('\mywishlist\models\annonce', $s);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment