Commit eb880c0d authored by Viral Solani's avatar Viral Solani
parents 9ffcda56 c81c0d6b
...@@ -25,4 +25,5 @@ phpunit.txt ...@@ -25,4 +25,5 @@ phpunit.txt
public/css public/css
public/js public/js
composer.lock composer.lock
public/img/backend/blog_images/* public/img/backend/blog_images/*
\ No newline at end of file
...@@ -75,25 +75,15 @@ class BlogsRepository extends BaseRepository ...@@ -75,25 +75,15 @@ class BlogsRepository extends BaseRepository
if ($blogs->save()) { if ($blogs->save()) {
// Inserting associated category's id in mapper table // Inserting associated category's id in mapper table
for ($i = 0; $i < count($categoriesArray); $i++) { if (count($categoriesArray)) {
$blogMapCategory[] = [ $blogs->categories()->sync($categoriesArray);
'blog_id' => $blogs->id,
'category_id' => $categoriesArray[$i],
];
} }
BlogMapCategory::insert($blogMapCategory);
// Inserting associated tag's id in mapper table // Inserting associated tag's id in mapper table
for ($i = 0; $i < count($tagsArray); $i++) { if (count($tagsArray)) {
$blogMapTags[] = [ $blogs->tags()->sync($tagsArray);
'blog_id' => $blogs->id,
'tag_id' => $tagsArray[$i],
];
} }
BlogMapTag::insert($blogMapTags);
event(new BlogCreated($blogs)); event(new BlogCreated($blogs));
return true; return true;
...@@ -104,14 +94,12 @@ class BlogsRepository extends BaseRepository ...@@ -104,14 +94,12 @@ class BlogsRepository extends BaseRepository
} }
/** /**
* @param Model $permission * @param $blogs
* @param $input * @param array $input
* * @param array $tagsArray
* @throws GeneralException * @param array $categoriesArray
*
* return bool
*/ */
public function update(Model $blogs, array $input, array $tagsArray, array $categoriesArray) public function update($blogs, array $input, array $tagsArray, array $categoriesArray)
{ {
// dd( Carbon::parse($input['publish_datetime'])); // dd( Carbon::parse($input['publish_datetime']));
// dd($input['publish_datetime']); // dd($input['publish_datetime']);
...@@ -137,27 +125,15 @@ class BlogsRepository extends BaseRepository ...@@ -137,27 +125,15 @@ class BlogsRepository extends BaseRepository
if ($blogs->save()) { if ($blogs->save()) {
// Updateing associated category's id in mapper table // Updateing associated category's id in mapper table
BlogMapCategory::where('blog_id', $blogs->id)->delete(); if (count($categoriesArray)) {
for ($i = 0; $i < count($categoriesArray); $i++) { $blogs->categories()->sync($categoriesArray);
$blogMapCategory[] = [
'blog_id' => $blogs->id,
'category_id' => $categoriesArray[$i],
];
} }
BlogMapCategory::insert($blogMapCategory);
// Updating associated tag's id in mapper table // Updating associated tag's id in mapper table
BlogMapTag::where('blog_id', $blogs->id)->delete(); if (count($tagsArray)) {
for ($i = 0; $i < count($tagsArray); $i++) { $blogs->tags()->sync($tagsArray);
$blogMapTags[] = [
'blog_id' => $blogs->id,
'tag_id' => $tagsArray[$i],
];
} }
BlogMapTag::insert($blogMapTags);
event(new BlogUpdated($blogs)); event(new BlogUpdated($blogs));
return true; return true;
......
{ {
"/js/frontend.js": "/js/frontend.d3a9d9963b6da237bfe8.js", "/js/frontend.js": "/js/frontend.f5faf334d6b2231b48c8.js",
"/js/backend.js": "/js/backend.51a14fd841ccd198e500.js", "/js/backend.js": "/js/backend.d106d5f7e2110ee3cea7.js",
"/mix.js": "/mix.247ab120fe7680658924.js", "/mix.js": "/mix.247ab120fe7680658924.js",
"/css/frontend.css": "/css/frontend.3af0a6cbd7d1d8d042f2a37e97008b7c.css", "/css/frontend.css": "/css/frontend.90a13bfbf8d4ea6a30a8eb218e8d48b3.css",
"/css/backend.css": "/css/backend.f8550f50504e5b8ef6055285205f223a.css", "/css/backend.css": "/css/backend.7b6d826816293ff35f4185341567f559.css",
"/css/backend-custom.css": "/css/backend-custom.50f14193ab908e3cf471dea6cb6616ae.css", "/css/backend-custom.css": "/css/backend-custom.187b92dacd8c501e4a19407d700d279b.css",
"/js/backend-custom.js": "/js/backend-custom.69e7d487a5a38a38520a62a5c53584f9.js", "/js/backend-custom.js": "/js/backend-custom.3ee9346acb0cd5e1f3edf70e9117e1f4.js",
"/js/dataTable.js": "/js/dataTable.f968d300a6a0b871f138f114361259c8.js" "/js/dataTable.js": "/js/dataTable.0db0f52a09a62d485aa1229ed981b1cf.js"
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment