Commit eb880c0d authored by Viral Solani's avatar Viral Solani
parents 9ffcda56 c81c0d6b
......@@ -26,3 +26,4 @@ public/css
public/js
composer.lock
public/img/backend/blog_images/*
......@@ -75,25 +75,15 @@ class BlogsRepository extends BaseRepository
if ($blogs->save()) {
// Inserting associated category's id in mapper table
for ($i = 0; $i < count($categoriesArray); $i++) {
$blogMapCategory[] = [
'blog_id' => $blogs->id,
'category_id' => $categoriesArray[$i],
];
if (count($categoriesArray)) {
$blogs->categories()->sync($categoriesArray);
}
BlogMapCategory::insert($blogMapCategory);
// Inserting associated tag's id in mapper table
for ($i = 0; $i < count($tagsArray); $i++) {
$blogMapTags[] = [
'blog_id' => $blogs->id,
'tag_id' => $tagsArray[$i],
];
if (count($tagsArray)) {
$blogs->tags()->sync($tagsArray);
}
BlogMapTag::insert($blogMapTags);
event(new BlogCreated($blogs));
return true;
......@@ -104,14 +94,12 @@ class BlogsRepository extends BaseRepository
}
/**
* @param Model $permission
* @param $input
*
* @throws GeneralException
*
* return bool
* @param $blogs
* @param array $input
* @param array $tagsArray
* @param array $categoriesArray
*/
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($input['publish_datetime']);
......@@ -137,27 +125,15 @@ class BlogsRepository extends BaseRepository
if ($blogs->save()) {
// Updateing associated category's id in mapper table
BlogMapCategory::where('blog_id', $blogs->id)->delete();
for ($i = 0; $i < count($categoriesArray); $i++) {
$blogMapCategory[] = [
'blog_id' => $blogs->id,
'category_id' => $categoriesArray[$i],
];
if (count($categoriesArray)) {
$blogs->categories()->sync($categoriesArray);
}
BlogMapCategory::insert($blogMapCategory);
// Updating associated tag's id in mapper table
BlogMapTag::where('blog_id', $blogs->id)->delete();
for ($i = 0; $i < count($tagsArray); $i++) {
$blogMapTags[] = [
'blog_id' => $blogs->id,
'tag_id' => $tagsArray[$i],
];
if (count($tagsArray)) {
$blogs->tags()->sync($tagsArray);
}
BlogMapTag::insert($blogMapTags);
event(new BlogUpdated($blogs));
return true;
......
{
"/js/frontend.js": "/js/frontend.d3a9d9963b6da237bfe8.js",
"/js/backend.js": "/js/backend.51a14fd841ccd198e500.js",
"/js/frontend.js": "/js/frontend.f5faf334d6b2231b48c8.js",
"/js/backend.js": "/js/backend.d106d5f7e2110ee3cea7.js",
"/mix.js": "/mix.247ab120fe7680658924.js",
"/css/frontend.css": "/css/frontend.3af0a6cbd7d1d8d042f2a37e97008b7c.css",
"/css/backend.css": "/css/backend.f8550f50504e5b8ef6055285205f223a.css",
"/css/backend-custom.css": "/css/backend-custom.50f14193ab908e3cf471dea6cb6616ae.css",
"/js/backend-custom.js": "/js/backend-custom.69e7d487a5a38a38520a62a5c53584f9.js",
"/js/dataTable.js": "/js/dataTable.f968d300a6a0b871f138f114361259c8.js"
"/css/frontend.css": "/css/frontend.90a13bfbf8d4ea6a30a8eb218e8d48b3.css",
"/css/backend.css": "/css/backend.7b6d826816293ff35f4185341567f559.css",
"/css/backend-custom.css": "/css/backend-custom.187b92dacd8c501e4a19407d700d279b.css",
"/js/backend-custom.js": "/js/backend-custom.3ee9346acb0cd5e1f3edf70e9117e1f4.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