Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function postLogin(Request $request)

{

$redirectTo = '/index';
$redirectTo = '/';
?>

<html>
Expand Down
131 changes: 90 additions & 41 deletions app/Http/Controllers/PagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function indextest()
public function index()
{
if (Auth::guest())
return view('auth.login');
return view('guestindex');

else
$user = Auth::user();
Expand All @@ -44,14 +44,23 @@ public function frettin()
{

$input = Request::all();
$image_name = Request::file('photo')->getClientOriginalName();
$input = Request::file('photo')->move(base_path().'/public/images', $image_name);
$post = (Request::except(['photo']));
$post['photo'] = $image_name;
$pathToFile = '/images/frettir/' . $post['photo'];
$forsida->frettmynd = $pathToFile;
$frettedit = Forsida::get()->where('id', 1)->first();
$frettedit->frettdagsins = $input['frettinn'];
/*if(count($input) == 4)
{
$image_name = Request::file('photo')->getClientOriginalName();
$inputt = Request::file('photo')->move(base_path().'/public/images/frettir', $image_name);
$post = (Request::except(['photo']));
$post['photo'] = $image_name;
$pathToFile = '/images/frettir/' . $post['photo'];

$frettedit->frettmynd = $pathToFile;
$frettedit->frettdagsins = $input['frettinn'];

}
else*/
$frettedit = Forsida::get()->where('id', 1)->first();
$frettedit->frettdagsins = $input['frettinn'];

$frettedit->save();
return redirect()->back();
}
Expand All @@ -64,50 +73,50 @@ public function profile($username)
{
$curruser = Auth::user();
$user = User::get()->where('username', $username)->first();
$comments = Profilecomments::latest('created_at')->get();
$profilecomments = Profilecomments::latest('created_at')->get();
$verkefnaf = Verkefnaferills::latest('created_at')->get();
if($user->username == $curruser->username)
{
return view('profile', compact('user','comments','curruser', 'verkefnaf'));
return view('profile', compact('user','profilecomments','curruser', 'verkefnaf'));

}
else {
return view('profileguest', compact('user','comments','curruser'));
return view('profileguest', compact('user','profilecomments','curruser','verkefnaf'));
}
}

public function store()
public function store(Request $request)
{

$input = Request::all();
$redirectTo = '/auth/register';
?>

<html>
<div class="alert alert-danger" role="alert" id="alertbox">
<p class="alert-link">Notendanafn eða email nú þegar í notkun.</div>
<script>
$(document).ready(function(){
setTimeout(function(){
$("#alertbox").fadeOut("slow", function () {
$("#alertbox").remove();
});

}, 1500);
});
</script>

<?php
/*
$user = User::where('username', '=' ,$input::get('username'))->first();
if($user != null)
{
return redirect()->back();
*/

if(User::find($input['username']))
{
?>

<html>
<div class="alert alert-danger" role="alert" id="alertbox">
<p class="alert-link">Notendanafn Í Notkun</p>
</div>
<script>
$(document).ready(function(){
setTimeout(function(){
$("#alertbox").fadeOut("slow", function () {
$("#alertbox").remove();
});

}, 1500);
});
</script>

<?php

if(User::where('username', '=', Input::get('username'))->exists())
{
return view('auth/register');
}
else
{
Expand All @@ -118,6 +127,11 @@ public function store()
User::create($input);
return redirect('/');
}
return redirect('auth/register')
->withInput($request->only('username'))
->withErrors([
'username' => 'Already in use',
]);
}

public function vefsidur()
Expand All @@ -128,7 +142,7 @@ public function vefsidur()
else
{
$user = Auth::user();
$vefsida = Vefspurn::latest('published_at')->get();
$vefsida = Vefspurn::latest('updated_at')->get();
return view('vefsida', compact('vefsida', 'user'));
}
}
Expand Down Expand Up @@ -173,7 +187,9 @@ public function showverk ($id)
{
$user = Auth::user();
$verktakar = Verktakar::findOrFail($id);
$verkcomments = Verk::latest('created_at')->get();
$verkcomments = Verkcomments::latest('created_at')->get();
$verktakar->viewcount = $verktakar->viewcount + 1;
$verktakar->save();

return view('showverk', compact('verktakar','user','verkcomments'));
}
Expand Down Expand Up @@ -219,7 +235,6 @@ public function vefedit($id)
{
$user = Auth::user();
$vefsida = Vefspurn::findOrFail($id);
//dd($vefsida);

return view('VefEdit', compact('vefsida','user'));
}
Expand All @@ -233,7 +248,6 @@ public function verkedit($id)
{
$user = Auth::user();
$verktakar = Verktakar::findOrFail($id);
//dd($vefsida);

return view('VerkEdit', compact('verktakar','user'));
}
Expand Down Expand Up @@ -342,7 +356,7 @@ public function helgi()
$user = Auth::user();
return view("/Helgi", compact('user'));
}
public function veljamann($username)
public function veljamann($username)
{
$input = Request::all();
$vefmann = Vefspurn::find($input['post_id']);
Expand All @@ -356,10 +370,45 @@ public function veljamann($username)

return redirect()->back();
}

public function breytacomments()
public function Veljaverktaka($username)
{
$input = Request::all();
$verkmann = Verktakar::find($input['post_id']);
$user = User::get()->where('username', $input['post_user'])->first();
$user->verkefni = $input['post_title'];
$verkmann->starfsmadur = $input['post_user'];
$user->save();
$verkmann->save();

Verkefnaferills::Create($input);

return redirect()->back();
}

public function breytacommentsvef()
{

$input = Request::all();
$vefcomments = Vefcomments::find($input['id']);
$vefcomments->comment = $input['comment'];
$vefcomments->save();
return redirect()->back();
}

public function breytacommentsverk()
{
$input = Request::all();
$verkcomments = Verkcomments::find($input['id']);
$verkcomments->comment = $input['comment'];
$verkcomments->save();
return redirect()->back();
}
public function breytacommentsprofile()
{
$input = Request::all();
$profilecomments = Profilecomments::find($input['id']);
$profilecomments->comment = $input['comment'];
$profilecomments->save();
return redirect()->back();
}

}//slaufusvigi??
14 changes: 6 additions & 8 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

Route::get('/', 'PagesController@index');
Route::get('/index', 'PagesController@index');
Route::get('/index', 'PagesController@indextest');
Route::get('index/{username}', 'PagesController@profile');
Route::get('/signup', 'PagesController@signUp');
Route::post('/', 'PagesController@store');
Expand All @@ -30,7 +30,9 @@

Route::post('/vefsida', 'PagesController@VefStore');
Route::post('/verktakar', 'PagesController@VerkStore');
Route::get('/breytacomment', 'PagesController@breytacomments');
Route::post('/vefsida/breytacomment', 'PagesController@breytacommentsvef');
Route::post('/verktakar/breytacomment', 'PagesController@breytacommentsverk');
Route::post('/index/breytacomment', 'PagesController@breytacommentsprofile');

Route::post('/setphoto', 'PagesController@PhotoId');
Route::post('/VefsaveComment', 'PagesController@vefComments');
Expand All @@ -42,7 +44,8 @@
Route::post('/frett', 'PagesController@frettin');


Route::post('/veljamann/{username}', 'PagesController@veljamann');
Route::post('/vefsida/veljamann/{username}', 'PagesController@veljamann');
Route::post('/verktakar/veljamann/{username}', 'PagesController@Veljaverktaka');


Route::post('/reddescrip', 'PagesController@editDescription');
Expand All @@ -59,11 +62,6 @@
Route::get('/contact', 'PagesController@contact');


Route::get('/helgi', 'PagesController@helgi');
Route::get('/kristmann', 'PagesController@kristmann');
Route::get('/contact', 'PagesController@contact');



Route::get('home', 'HomeController@index');

Expand Down
2 changes: 1 addition & 1 deletion app/Profilecomments.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Profilecomments extends Model {
*
* @var array
*/
protected $fillable = ['id', 'profile_name', 'comment', 'current_user'];
protected $fillable = ['id', 'profile_name', 'comment', 'current_user', 'current_userPhoto'];
//

}
2 changes: 1 addition & 1 deletion app/Vefspurn.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Vefspurn extends Model {
* @var array
*/

protected $fillable = ['id', 'title', 'body','hofundur', 'current_photo' , 'starfsmadur', 'view_count'];
protected $fillable = ['id', 'title', 'body','hofundur', 'current_photo' , 'starfsmadur'];


}
19 changes: 19 additions & 0 deletions d41d8cd9.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
APP_ENV=local
APP_DEBUG=true
APP_KEY=umR92z5s5ies7mmYjmXzjtqznL7DCtuh

DB_HOST=localhost
DB_DATABASE=homestead10
DB_USERNAME=root
DB_PASSWORD=

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function up()
$table->text('hofundur');
$table->text('current_photo');
$table->text('starfsmadur');
$table->integer('view_count')->default(0);
$table->integer('viewcount')->default(0);
$table->timestamps();
$table->timestamp('published_at');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function up()
$table->text('profile_name');
$table->text('comment');
$table->text('current_user');
$table->string('current_userPhoto');
$table->timestamps();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function up()
Schema::create('verkefnaferills', function(Blueprint $table)
{
$table->increments('id');
$table->string('post_type');
$table->string('post_id');
$table->string('post_title');
$table->string('post_user');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,9 @@ public function up()
Schema::create('forsidas', function(Blueprint $table)
{
$table->increments('id');
$table->string('frettdagsins');
$table->string('frettmynd');
$table->string('frettdagsins', 1000);
$table->timestamps();
});
Schema::insert(insert into forsidas ('id', 'frettdagsins', 'frettmynd', 'created_at') VALUES (1, 'Engin Frétt Í Dag', 'yoyo', 'now()'));

/*Schema::table('forsidas')->insert(
['frettdagsins' => 'Ekki neitt í dag', 'votes' => 1]
);*/
}

/**
Expand Down
Loading