@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - Schema::create('BlogCategory', function (Blueprint $table) { |
|
| 16 | + Schema::create('BlogCategory', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->string('name', 100); |
| 19 | 19 | $table->string('slug', 100); |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | $table->creation(); |
| 25 | 25 | }); |
| 26 | 26 | |
| 27 | - Schema::table('BlogCategory', function (Blueprint $table) { |
|
| 27 | + Schema::table('BlogCategory', function(Blueprint $table) { |
|
| 28 | 28 | $table->creationRelation(); |
| 29 | 29 | }); |
| 30 | 30 | |
| 31 | - Schema::create('BlogPost', function (Blueprint $table) { |
|
| 31 | + Schema::create('BlogPost', function(Blueprint $table) { |
|
| 32 | 32 | $table->increments('id'); |
| 33 | 33 | $table->string('title', 100); |
| 34 | 34 | $table->string('slug', 100); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $table->foreign('author')->references('id')->on('User'); |
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | - Schema::table('BlogPost', function (Blueprint $table) { |
|
| 51 | + Schema::table('BlogPost', function(Blueprint $table) { |
|
| 52 | 52 | $table->creationRelation(); |
| 53 | 53 | }); |
| 54 | 54 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | protected static $categoryModel = 'jlourenco\blog\Models\BlogCategory'; |
| 42 | 42 | |
| 43 | - protected $dates = [ 'created_at', 'deleted_at']; |
|
| 43 | + protected $dates = ['created_at', 'deleted_at']; |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * {@inheritDoc}
|
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | if ($value > 0) |
| 121 | 121 | if ($user = Sentinel::findUserById($value)) |
| 122 | 122 | if ($user != null) |
| 123 | - return $user->first_name . ' ' . $user->last_name; |
|
| 123 | + return $user->first_name.' '.$user->last_name; |
|
| 124 | 124 | |
| 125 | 125 | return $value; |
| 126 | 126 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | 'slug' |
| 32 | 32 | ]; |
| 33 | 33 | |
| 34 | - protected $dates = [ 'created_at', 'deleted_at']; |
|
| 34 | + protected $dates = ['created_at', 'deleted_at']; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * The Blog post model name. |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * All the "restricted area" routes |
| 8 | 8 | * are defined here. |
| 9 | 9 | */ |
| 10 | -Route::group(array('prefix' => '/', 'middleware' => 'webPublic'), function ()
|
|
| 10 | +Route::group(array('prefix' => '/', 'middleware' => 'webPublic'), function()
|
|
| 11 | 11 | {
|
| 12 | 12 | |
| 13 | 13 | # Blog pages |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | * All the "restricted area" routes |
| 26 | 26 | * are defined here. |
| 27 | 27 | */ |
| 28 | -Route::group(array('prefix' => '/admin', 'middleware' => ['webAdmin', 'auth']), function ()
|
|
| 28 | +Route::group(array('prefix' => '/admin', 'middleware' => ['webAdmin', 'auth']), function()
|
|
| 29 | 29 | {
|
| 30 | 30 | |
| 31 | 31 | # Blog Management |
| 32 | - Route::group(array('prefix' => 'categories'), function () {
|
|
| 32 | + Route::group(array('prefix' => 'categories'), function() {
|
|
| 33 | 33 | Route::get('/list', array('as' => 'categories', 'uses' => 'jlourenco\blog\Controllers\CategoryController@index'));
|
| 34 | 34 | Route::get('/create', array('as' => 'create.category', 'uses' => 'jlourenco\blog\Controllers\CategoryController@getCreate'));
|
| 35 | 35 | Route::post('/create', 'jlourenco\blog\Controllers\CategoryController@postCreate');
|
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | Route::get('{blogId}/delete', array('as' => 'delete/category', 'uses' => 'jlourenco\blog\Controllers\CategoryController@getDelete'));
|
| 39 | 39 | Route::get('{blogId}/confirm-delete', array('as' => 'confirm-delete/category', 'uses' => 'jlourenco\blog\Controllers\CategoryController@getModalDelete'));
|
| 40 | 40 | Route::get('{blogId}/restore', array('as' => 'restore/category', 'uses' => 'jlourenco\blog\Controllers\CategoryController@getRestore'));
|
| 41 | - Route::get('deleted',array('as' => 'categories.deleted', 'uses' => 'jlourenco\blog\Controllers\CategoryController@getDeletedCategories'));
|
|
| 41 | + Route::get('deleted', array('as' => 'categories.deleted', 'uses' => 'jlourenco\blog\Controllers\CategoryController@getDeletedCategories'));
|
|
| 42 | 42 | Route::get('{blogId}', array('as' => 'category.show', 'uses' => 'jlourenco\blog\Controllers\CategoryController@show'));
|
| 43 | 43 | }); |
| 44 | 44 | |
| 45 | - Route::group(array('prefix' => 'posts'), function () {
|
|
| 45 | + Route::group(array('prefix' => 'posts'), function() {
|
|
| 46 | 46 | Route::get('/list', array('as' => 'posts', 'uses' => 'jlourenco\blog\Controllers\PostController@index'));
|
| 47 | 47 | Route::get('/create', array('as' => 'create.post', 'uses' => 'jlourenco\blog\Controllers\PostController@getCreate'));
|
| 48 | 48 | Route::post('/create', 'jlourenco\blog\Controllers\PostController@postCreate');
|
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | Route::get('{blogId}/delete', array('as' => 'delete/post', 'uses' => 'jlourenco\blog\Controllers\PostController@getDelete'));
|
| 52 | 52 | Route::get('{blogId}/confirm-delete', array('as' => 'confirm-delete/post', 'uses' => 'jlourenco\blog\Controllers\PostController@getModalDelete'));
|
| 53 | 53 | Route::get('{blogId}/restore', array('as' => 'restore/post', 'uses' => 'jlourenco\blog\Controllers\PostController@getRestore'));
|
| 54 | - Route::get('deleted',array('as' => 'posts.deleted', 'uses' => 'jlourenco\blog\Controllers\PostController@getDeletedCategories'));
|
|
| 54 | + Route::get('deleted', array('as' => 'posts.deleted', 'uses' => 'jlourenco\blog\Controllers\PostController@getDeletedCategories'));
|
|
| 55 | 55 | Route::get('{blogId}', array('as' => 'post.show', 'uses' => 'jlourenco\blog\Controllers\PostController@show'));
|
| 56 | 56 | }); |
| 57 | 57 | |
@@ -41,31 +41,31 @@ discard block |
||
| 41 | 41 | // Publish our views |
| 42 | 42 | $this->loadViewsFrom(base_path("resources/views"), 'base'); |
| 43 | 43 | $this->publishes([ |
| 44 | - __DIR__ . '/views' => base_path("resources/views") |
|
| 44 | + __DIR__.'/views' => base_path("resources/views") |
|
| 45 | 45 | ]); |
| 46 | 46 | |
| 47 | 47 | // Publish our lang |
| 48 | 48 | $this->publishes([ |
| 49 | - __DIR__ . '/lang' => base_path("resources/lang") |
|
| 49 | + __DIR__.'/lang' => base_path("resources/lang") |
|
| 50 | 50 | ], 'migrations'); |
| 51 | 51 | |
| 52 | 52 | // Publish our migrations |
| 53 | 53 | $this->publishes([ |
| 54 | - __DIR__ . '/migrations' => base_path("database/migrations") |
|
| 54 | + __DIR__.'/migrations' => base_path("database/migrations") |
|
| 55 | 55 | ], 'migrations'); |
| 56 | 56 | |
| 57 | 57 | // Publish a config file |
| 58 | 58 | $this->publishes([ |
| 59 | - __DIR__ . '/config' => base_path('/config') |
|
| 59 | + __DIR__.'/config' => base_path('/config') |
|
| 60 | 60 | ], 'config'); |
| 61 | 61 | |
| 62 | 62 | // Publish our routes |
| 63 | 63 | $this->publishes([ |
| 64 | - __DIR__ . '/routes.php' => base_path("app/Http/blog_routes.php") |
|
| 64 | + __DIR__.'/routes.php' => base_path("app/Http/blog_routes.php") |
|
| 65 | 65 | ], 'routes'); |
| 66 | 66 | |
| 67 | 67 | // Include the routes file |
| 68 | - if(file_exists(base_path("app/Http/blog_routes.php"))) |
|
| 68 | + if (file_exists(base_path("app/Http/blog_routes.php"))) |
|
| 69 | 69 | include base_path("app/Http/blog_routes.php"); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | protected function registerBlogPost() |
| 78 | 78 | { |
| 79 | - $this->app->singleton('jlourenco.blog.post', function ($app) { |
|
| 79 | + $this->app->singleton('jlourenco.blog.post', function($app) { |
|
| 80 | 80 | $baseConfig = $app['config']->get('jlourenco.base'); |
| 81 | 81 | $config = $app['config']->get('jlourenco.blog'); |
| 82 | 82 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | protected function registerBlogCategory() |
| 103 | 103 | { |
| 104 | - $this->app->singleton('jlourenco.blog.category', function ($app) { |
|
| 104 | + $this->app->singleton('jlourenco.blog.category', function($app) { |
|
| 105 | 105 | $config = $app['config']->get('jlourenco.blog'); |
| 106 | 106 | |
| 107 | 107 | $model = array_get($config, 'models.BlogCategory'); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | protected function registerBlog() |
| 123 | 123 | { |
| 124 | - $this->app->singleton('blog', function ($app) { |
|
| 124 | + $this->app->singleton('blog', function($app) { |
|
| 125 | 125 | $blog = new Blog($app['jlourenco.blog.post'], $app['jlourenco.blog.category']); |
| 126 | 126 | |
| 127 | 127 | return $blog; |
@@ -86,16 +86,16 @@ discard block |
||
| 86 | 86 | $categories = $this->applySearch(Blog::getCategoriesRepository(), $terms, ['name', 'description'])->select('name as a', DB::raw('\'Category\' AS type'))->distinct()->get()->toArray();
|
| 87 | 87 | |
| 88 | 88 | // Returning the results |
| 89 | - return response()->json( [ 'data' => array_merge($users, $categories, $posts) ] ); |
|
| 89 | + return response()->json(['data' => array_merge($users, $categories, $posts)]); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | public function applySearch($repo, $terms, $fields) |
| 93 | 93 | {
|
| 94 | - foreach($terms as $term) |
|
| 95 | - foreach($fields as $field) |
|
| 96 | - $repo = $repo->orWhere($field, 'LIKE', '%' . $term . '%'); |
|
| 94 | + foreach ($terms as $term) |
|
| 95 | + foreach ($fields as $field) |
|
| 96 | + $repo = $repo->orWhere($field, 'LIKE', '%'.$term.'%'); |
|
| 97 | 97 | |
| 98 | - foreach($repo as $data) |
|
| 98 | + foreach ($repo as $data) |
|
| 99 | 99 | {
|
| 100 | 100 | dd($repo); |
| 101 | 101 | } |
@@ -147,19 +147,19 @@ discard block |
||
| 147 | 147 | // Was the post updated? |
| 148 | 148 | if ($post->comments()->save($c)) |
| 149 | 149 | {
|
| 150 | - Base::Log('Comment added to (' . $post->id . ').');
|
|
| 150 | + Base::Log('Comment added to ('.$post->id.').');
|
|
| 151 | 151 | |
| 152 | 152 | // Prepare the success message |
| 153 | 153 | $success = Lang::get('blog.comment.created');
|
| 154 | 154 | |
| 155 | 155 | // Redirect to the user page |
| 156 | - return Redirect('blog/' . $post->id)->with('success', $success);
|
|
| 156 | + return Redirect('blog/'.$post->id)->with('success', $success);
|
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $error = Lang::get('blog.comment.error');
|
| 160 | 160 | |
| 161 | 161 | // Redirect to the post page |
| 162 | - return Redirect('blog/' . $post->id)->withInput()->with('error', $error);
|
|
| 162 | + return Redirect('blog/'.$post->id)->withInput()->with('error', $error);
|
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $cat = Blog::getCategoriesRepository()->find($id); |
| 64 | 64 | |
| 65 | 65 | // Get the category information |
| 66 | - if($cat == null) |
|
| 66 | + if ($cat == null) |
|
| 67 | 67 | {
|
| 68 | 68 | // Prepare the error message |
| 69 | 69 | $error = Lang::get('blog.category.not_found');
|
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | // Was the category updated? |
| 122 | 122 | if ($cat->save()) |
| 123 | 123 | {
|
| 124 | - Base::Log('Category (' . $cat->name . ') was edited.');
|
|
| 124 | + Base::Log('Category ('.$cat->name.') was edited.');
|
|
| 125 | 125 | |
| 126 | 126 | // Prepare the success message |
| 127 | 127 | $success = Lang::get('blog.category.changed');
|
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | $cat->save(); |
| 183 | 183 | |
| 184 | - Base::Log('A new category (' . $cat->name . ') was created.');
|
|
| 184 | + Base::Log('A new category ('.$cat->name.') was created.');
|
|
| 185 | 185 | |
| 186 | 186 | // Redirect to the home page with success menu |
| 187 | 187 | return Redirect::route("categories")->with('success', Lang::get('blog.category.created'));
|
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | return Redirect::route('categories')->with('error', $error);
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - Base::Log('Category (' . $cat->name . ') was deleted.');
|
|
| 237 | + Base::Log('Category ('.$cat->name.') was deleted.');
|
|
| 238 | 238 | |
| 239 | 239 | // Delete the category |
| 240 | 240 | $cat->delete(); |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | return Redirect::route('category.deleted')->with('error', $error);
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - Base::Log('Category (' . $cat->name . ') was restored.');
|
|
| 283 | + Base::Log('Category ('.$cat->name.') was restored.');
|
|
| 284 | 284 | |
| 285 | 285 | // Restore the category |
| 286 | 286 | $cat->restore(); |
@@ -1,15 +1,11 @@ |
||
| 1 | 1 | <?php namespace jlourenco\blog\Controllers; |
| 2 | 2 | |
| 3 | -use Illuminate\Http\Request; |
|
| 4 | -use App\Http\Requests; |
|
| 5 | -use App\Http\Controllers\Controller; |
|
| 6 | -use Blog; |
|
| 7 | -use Sentinel; |
|
| 8 | -use Searchy; |
|
| 9 | -use Validator; |
|
| 10 | -use Input; |
|
| 11 | -use Base; |
|
| 12 | -use Redirect; |
|
| 3 | +use App\Http\Controllers\Controller; |
|
| 4 | +use Blog; |
|
| 5 | +use Validator; |
|
| 6 | +use Input; |
|
| 7 | +use Base; |
|
| 8 | +use Redirect; |
|
| 13 | 9 | use Lang; |
| 14 | 10 | |
| 15 | 11 | class CategoryController extends Controller |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $post = Blog::getPostsRepository()->find($id); |
| 66 | 66 | |
| 67 | 67 | // Get the post information |
| 68 | - if($post == null) |
|
| 68 | + if ($post == null) |
|
| 69 | 69 | {
|
| 70 | 70 | // Prepare the error message |
| 71 | 71 | $error = Lang::get('blog.posts.not_found');
|
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $cats[$cat->id] = $cat->name; |
| 85 | 85 | |
| 86 | 86 | foreach ($authors as $author) |
| 87 | - $users[$author->id] = $author->first_name . ' ' . $author->last_name; |
|
| 87 | + $users[$author->id] = $author->first_name.' '.$author->last_name; |
|
| 88 | 88 | |
| 89 | 89 | // Show the page |
| 90 | 90 | return View('admin.posts.edit', compact('post', 'cats', 'users'));
|
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | // Was the post updated? |
| 138 | 138 | if ($post->save()) |
| 139 | 139 | {
|
| 140 | - Base::Log('Post (' . $post->id . ') was edited.');
|
|
| 140 | + Base::Log('Post ('.$post->id.') was edited.');
|
|
| 141 | 141 | |
| 142 | 142 | // Prepare the success message |
| 143 | 143 | $success = Lang::get('blog.posts.changed');
|
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $cats[$cat->id] = $cat->name; |
| 170 | 170 | |
| 171 | 171 | foreach ($authors as $author) |
| 172 | - $users[$author->id] = $author->first_name . ' ' . $author->last_name; |
|
| 172 | + $users[$author->id] = $author->first_name.' '.$author->last_name; |
|
| 173 | 173 | |
| 174 | 174 | // Show the page |
| 175 | 175 | return View('admin.posts.create', compact('cats', 'users'));
|
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $post->save(); |
| 217 | 217 | |
| 218 | - Base::Log('A new post (' . $post->id . ') was created.');
|
|
| 218 | + Base::Log('A new post ('.$post->id.') was created.');
|
|
| 219 | 219 | |
| 220 | 220 | // Redirect to the home page with success menu |
| 221 | 221 | return Redirect::route("posts")->with('success', Lang::get('blog.posts.created'));
|
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | return Redirect::route('posts')->with('error', $error);
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - Base::Log('Post (' . $post->id . ') was deleted.');
|
|
| 271 | + Base::Log('Post ('.$post->id.') was deleted.');
|
|
| 272 | 272 | |
| 273 | 273 | // Delete the post |
| 274 | 274 | $post->delete(); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | return Redirect::route('post.deleted')->with('error', $error);
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - Base::Log('Post (' . $post->id . ') was restored.');
|
|
| 317 | + Base::Log('Post ('.$post->id.') was restored.');
|
|
| 318 | 318 | |
| 319 | 319 | // Restore the post |
| 320 | 320 | $post->restore(); |
@@ -1,15 +1,12 @@ |
||
| 1 | 1 | <?php namespace jlourenco\blog\Controllers; |
| 2 | 2 | |
| 3 | -use Illuminate\Http\Request; |
|
| 4 | -use App\Http\Requests; |
|
| 5 | -use App\Http\Controllers\Controller; |
|
| 6 | -use Blog; |
|
| 7 | -use Sentinel; |
|
| 8 | -use Searchy; |
|
| 9 | -use Validator; |
|
| 10 | -use Input; |
|
| 11 | -use Base; |
|
| 12 | -use Redirect; |
|
| 3 | +use App\Http\Controllers\Controller; |
|
| 4 | +use Blog; |
|
| 5 | +use Sentinel; |
|
| 6 | +use Validator; |
|
| 7 | +use Input; |
|
| 8 | +use Base; |
|
| 9 | +use Redirect; |
|
| 13 | 10 | use Lang; |
| 14 | 11 | |
| 15 | 12 | class PostController extends Controller |