diff --git a/app/controllers/ProjectsController.php b/app/controllers/ProjectsController.php index d25908b..8901ea3 100644 --- a/app/controllers/ProjectsController.php +++ b/app/controllers/ProjectsController.php @@ -15,6 +15,14 @@ class ProjectsController extends \BaseController { } + public function fetchProject($url = null) + { + $session = curl_init('http://simpledeveloper.com/'); + curl_setopt($session, CURLOPT_RETURNTRANSFER,true); + $json = curl_exec($session); + + return $json; + } /** * Show the form for creating a new resource. @@ -38,7 +46,7 @@ class ProjectsController extends \BaseController { 'title' => 'required|min:5', 'link' => 'required|url', 'language' => 'required' - ); + ); $data = Input::all(); @@ -53,6 +61,7 @@ class ProjectsController extends \BaseController { { $project = Project::firstOrCreate( array( + 'user_id' => Auth::id(), 'title' => Input::get('title'), 'link' => Input::get('link'), 'language' => Input::get('language') @@ -125,6 +134,7 @@ class ProjectsController extends \BaseController { ->withInput(Input::all()); }else { + $project->user_id = Auth::id(); $project->title = Input::get('title'); $project->link = Input::get('link'); $project->language = Input::get('language'); diff --git a/app/database/migrations/2014_07_06_040450_alter_users_table_add_deleted_at_column.php b/app/database/migrations/2014_07_06_040450_alter_users_table_add_deleted_at_column.php index 1ba4bed..e253313 100644 --- a/app/database/migrations/2014_07_06_040450_alter_users_table_add_deleted_at_column.php +++ b/app/database/migrations/2014_07_06_040450_alter_users_table_add_deleted_at_column.php @@ -25,7 +25,10 @@ class AlterUsersTableAddDeletedAtColumn extends Migration { */ public function down() { - //do nothing here + Schema::table('users', function(Blueprint $table) + { + $table->dropColumn('deleted_at'); + }); } } diff --git a/app/database/migrations/2014_07_07_034137_alter_projects_table_add_user_id_column.php b/app/database/migrations/2014_07_07_034137_alter_projects_table_add_user_id_column.php new file mode 100644 index 0000000..04d9859 --- /dev/null +++ b/app/database/migrations/2014_07_07_034137_alter_projects_table_add_user_id_column.php @@ -0,0 +1,38 @@ +integer('user_id')->unsigned()->after('id'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade'); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('projects', function(Blueprint $table) + { + $table->dropColumn('user_id'); + $table->dropForeign('user_id'); + $table->dropColumn('deleted_at'); + }); + } + +} diff --git a/app/models/Project.php b/app/models/Project.php index 3ea4de4..6a75fd9 100644 --- a/app/models/Project.php +++ b/app/models/Project.php @@ -1,5 +1,7 @@ - Mentconnect - Login + Mentconnect - Add New Projects {{HTML::style('css/mentconnect.css')}} {{HTML::style('css/denied.css')}} @@ -13,16 +13,13 @@
- {{ HTML::image("images/mentconnect.png", "editor", array("width" => "130px", "height" => "44px")) }} + {{ HTML::image("images/mentconnect.png", "mentconnect", array("width" => "130px", "height" => "44px")) }}