Changeset f457265 for app/Http/Controllers/Blog
- Timestamp:
- 02/24/21 21:58:42 (4 years ago)
- Branches:
- master
- Children:
- ff9da8b
- Parents:
- 0c07a90
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/Blog/BlogController.php
r0c07a90 rf457265 4 4 5 5 use App\Http\Requests\Blog\CommentRequest; 6 use App\Http\Requests\Blog\CompanyRequest; 6 7 use App\Http\Requests\Blog\PostLikeRequest; 7 8 use App\Http\Requests\Blog\PostUnlikeRequest; 9 use App\Models\Company; 8 10 use App\Models\Tag; 9 11 use App\Models\Like; … … 15 17 use App\Http\Controllers\Controller; 16 18 use App\Notifications\NewCommentAdded; 19 use Illuminate\Support\Facades\DB; 17 20 18 21 class BlogController extends Controller … … 226 229 ]); 227 230 } 231 232 public function storeCompany(CompanyRequest $request) 233 { 234 DB::transaction(function () use ($request) { 235 236 $company = new Company(); 237 $company->name = $request->name; 238 $company->website = $request->website; 239 $company->email = $request->email; 240 241 $company->save(); 242 243 if ($company->wasRecentlyCreated) { 244 $this->disableOfferModal(); 245 } 246 }); 247 248 return redirect()->route("blog.index"); 249 } 250 251 public function disableOffer() 252 { 253 $this->disableOfferModal(); 254 return redirect()->route("blog.index"); 255 } 256 257 private function disableOfferModal() 258 { 259 if (!session()->has("offer_disabled")) { 260 session()->push("offer_disabled", true); 261 } 262 } 228 263 }
Note:
See TracChangeset
for help on using the changeset viewer.