Skip to content

Commit

Permalink
110320: v1
Browse files Browse the repository at this point in the history
  • Loading branch information
gibmyx committed Mar 12, 2020
1 parent 8aa2973 commit e59c2e8
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 3 deletions.
83 changes: 80 additions & 3 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Controllers;

use App\Proyecto;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

Expand All @@ -27,7 +28,16 @@ public function __construct()
*/
public function index(Request $request)
{
return view('home');
$user = Auth::user();
$data = ['usuario' => $user->name,
"apellido" => $user->last,
'email' => $user->email,
'user_id' => $user->id,
"profile" => $user->profile,
"sex" => $user->sex
];

return view('home', compact('data'));
}

public function ajax_get_detalle()
Expand All @@ -40,8 +50,75 @@ public function ajax_get_detalle()
'email' => $user->email,
'user_id' => $user->id,
"profile" => $user->profile,
"sex" => $user->sex]
];
"sex" => $user->sex,
"proyectos" => (new Proyecto())->where('user_id', $user->id)->get()-toArray(),
]
];
return response()->json($response, 200);
}
/**
* 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 int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}

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

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

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
66 changes: 66 additions & 0 deletions app/Http/Controllers/dashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,71 @@ 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 int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}

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

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

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}


}
84 changes: 84 additions & 0 deletions app/Http/Controllers/proyectosController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class proyectosController 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 int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}

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

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

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

namespace App;

use Illuminate\Database\Eloquent\Model;

class Proyecto extends Model
{
protected $table = 'proyectos';
protected $fillable = [
'id',
'nombre',
'descripcion',
'user_id',
];
}
35 changes: 35 additions & 0 deletions database/migrations/2020_02_27_015344_create_proyectos_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

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

class CreateProyectosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('proyectos', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('nombre')->nullable(false);
$table->string('descripcion');
$table->unsignedBigInteger('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users');
$table->timestamps();
});
}

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

0 comments on commit e59c2e8

Please sign in to comment.