Skip to content

Commit

Permalink
Commit #26 - adding new features in the admin section
Browse files Browse the repository at this point in the history
  • Loading branch information
sharbel93 committed Jan 9, 2019
1 parent 102f63d commit 658f819
Show file tree
Hide file tree
Showing 39 changed files with 1,009 additions and 40 deletions.
10 changes: 10 additions & 0 deletions app/Daily.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Daily extends Model
{
//
}
10 changes: 10 additions & 0 deletions app/Event.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Event extends Model
{
//
}
4 changes: 3 additions & 1 deletion app/Http/Controllers/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Http\Request;
use App\Category;
use Session;
class CategoryController extends Controller
{
//
Expand Down Expand Up @@ -49,7 +50,8 @@ public function store(Request $request)
$category->name = $request->name;
$category->save();

return redirect()->route('categories.index');
return redirect()->route('categories.index')->with('success', 'added successfully!');


}

Expand Down
92 changes: 92 additions & 0 deletions app/Http/Controllers/DailyController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Session;
use App\Daily;

class DailyController extends Controller
{
public function __construct()
{
$this->middleware('role:superadministrator|administrator|editor|author|contributor');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$daily = Daily::all();
return view('manage.dailies.index')->withDailys($daily);

}

/**
* 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)
{
//
}
}
90 changes: 90 additions & 0 deletions app/Http/Controllers/EventController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Session;
use App\Event;
class EventController extends Controller
{
public function __construct()
{
$this->middleware('role:superadministrator|administrator|editor|author|contributor');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$event = Event::all();
return view('manage.events.index')->withEvents($event);
}

/**
* 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)
{
//
}
}
91 changes: 91 additions & 0 deletions app/Http/Controllers/PhotoController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Session;
use App\Photo;
class PhotoController extends Controller
{

public function __construct()
{
$this->middleware('role:superadministrator|administrator|editor|author|contributor');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$photo = Photo::all();
return view('manage.photos.index')->withPhotos($photo);
}

/**
* 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)
{
//
}
}
8 changes: 6 additions & 2 deletions app/Http/Controllers/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Intervention\Image\ImageManagerStatic as Image;
use Auth;
use Purifier;
use LaraFlash;
use Session;
use Illuminate\Http\Request;

Expand Down Expand Up @@ -45,6 +46,8 @@ public function create()
return view('manage.posts.create')->withCategories($categories)->withTags($tags);
}



/**
* Store a newly created resource in storage.
*
Expand All @@ -59,7 +62,7 @@ public function store(Request $request)
'slug' => 'required|alpha_dash |min:5 |max: 255|unique:posts,slug',
'category_id' => 'required|integer',
'content'=> 'required',
'thumbnail' => 'sometimes|image|mimes:jpeg,png,jpg,gif,svg|max:2048'
'thumbnail' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048'
));
// 'inputImage' => 'sometimes|image|mimes:jpeg,png,jpg,gif,svg|max:2048'

Expand Down Expand Up @@ -139,7 +142,8 @@ public function edit($id)
$tagsArray[$tag->id] = $tag->name;
}
// return the view and pass in the var we previously created
return view('manage.posts.edit')->withPost($post)->withCategories($cats)->withTags($tagsArray);
return view('manage.posts.edit')->withPost($post)->withCategories($cats)->withTags($tagsArray)->with
('success', 'Edited successfully!');

}

Expand Down
Loading

0 comments on commit 658f819

Please sign in to comment.