Skip to content

Commit

Permalink
todas las migraciones añadidas. Arreglando métodos
Browse files Browse the repository at this point in the history
  • Loading branch information
AdryDev92 committed Mar 11, 2018
1 parent 2cbb270 commit 556eaa8
Show file tree
Hide file tree
Showing 26 changed files with 509 additions and 24 deletions.
1 change: 0 additions & 1 deletion app/Citas.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Citas extends Model
* @var array
*/
protected $fillable = [
'id',
'id_perro',
'id_usuario',
'fecha',
Expand Down
2 changes: 1 addition & 1 deletion app/Comentarios.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ class Comentarios extends Model
protected $fillable = [
'content',
'user',
'coment_date'
'comment_date'
];
}
85 changes: 85 additions & 0 deletions app/Http/Controllers/LoggedController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

namespace App\Http\Controllers;

use App\Logged;
use Illuminate\Http\Request;

class LoggedController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*
* @param \App\Logged $logged
* @return \Illuminate\Http\Response
*/
public function show(Logged $logged)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param \App\Logged $logged
* @return \Illuminate\Http\Response
*/
public function edit(Logged $logged)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Logged $logged
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Logged $logged)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param \App\Logged $logged
* @return \Illuminate\Http\Response
*/
public function destroy(Logged $logged)
{
//
}
}
13 changes: 13 additions & 0 deletions app/Logged.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Logged extends Model
{
protected $table = 'Logged';
protected $fillable = [
'login_date'
];
}
6 changes: 5 additions & 1 deletion app/Productos.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@

class Productos extends Model
{
//
protected $table = 'Productos';
protected $fillable = [
'name',
'price'
];
}
6 changes: 5 additions & 1 deletion app/Servicios.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@

class Servicios extends Model
{
//
protected $table = 'Servicios';
protected $fillable = [
'name',
'price'
];
}
28 changes: 21 additions & 7 deletions app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,34 @@ public function dogs(){
return $this->hasMany(Perro::class);
}

/**
* Un usuario pone una valoracion
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function values(){
return $this->hasOne(Valoraciones::class);
}

/**
* Un usuario puede escribir comentarios
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function comment(){
return $this->hasMany(Comentarios::class)->latest();
}

/**
* Un usuario puede tener varios perros
* @return \Illuminate\Database\Query\Builder|static
*/
public function hasDog(){
if( count(User::class->hasMany(Perro::class)) ){
if( count(User::class->dogs()) ){
return $this->dogs();
}
}
/**
* Un usuario puede escribir comentarios
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function comment(){
return $this->hasOne(Comentarios::class);

public function logged(){
return $this->hasOne(Logged::class);
}

}
6 changes: 5 additions & 1 deletion app/Valoraciones.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@

class Valoraciones extends Model
{
//

protected $table = 'Valoraciones';
protected $fillable = [
'rate'
];
}
2 changes: 1 addition & 1 deletion database/factories/PerroFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'color' => $faker->colorName,
'cut' => $faker->realText(100),
'notes' => $faker->realText(100),
'born_date' => $faker->date('d-m-Y',1),
'born_date' => $faker->date('d/m/Y',1),
'transport' => $faker->boolean(50)

];
Expand Down
33 changes: 33 additions & 0 deletions database/migrations/2018_03_11_195650_create_roles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRoles extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('roles', function (Blueprint $table) {
$table->string('admin');
$table->string('user');
$table->increments('id');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('roles');
}
}
34 changes: 34 additions & 0 deletions database/migrations/2018_03_11_200842_create_comentarios.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateComentarios extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('comentarios', function (Blueprint $table) {
$table->increments('id');
$table->string('content');
$table->string('user');
$table->date('comment_date');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('comentarios');
}
}
31 changes: 31 additions & 0 deletions database/migrations/2018_03_11_200901_create_productos.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProductos extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('productos', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('productos');
}
}
31 changes: 31 additions & 0 deletions database/migrations/2018_03_11_200918_create_servicios.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateServicios extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('servicios', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('servicios');
}
}
31 changes: 31 additions & 0 deletions database/migrations/2018_03_11_200942_create_recibos.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRecibos extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('recibos', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('recibos');
}
}
31 changes: 31 additions & 0 deletions database/migrations/2018_03_11_201016_create_citas.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCitas extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('citas', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('citas');
}
}
Loading

0 comments on commit 556eaa8

Please sign in to comment.