public function update(Announcement $announcement, Request $request) { $user = Auth::user(); $announcement->update(['content' => $request->input('content'), 'expired_at' => $request->input('expired_at')]); Flash::success(trans('admin/messages.announcementUpdated')); return redirect(route('admin.announcement.index')); }
/** * Run the database seeds. * * @return void */ public function run() { for ($i = 0; $i <= 20; $i++) { $announcement = new Announcement(); $announcement->title = str_random(10); $announcement->binfo = true; $announcement->message = str_random(40); $announcement->save(); $announcement = new Announcement(); $announcement->title = str_random(10); $announcement->binfo = false; $announcement->message = str_random(40); $announcement->save(); } // }
public function index() { $limit = 3; $announcement = Announcement::orderBy('created_at', 'desc')->limit($limit)->get(); $trainings = Training::orderBy('start_date', 'asc')->get(); return view('bard_frontend.index', compact('announcement'), compact('trainings')); //return view('bard_frontend/index')->with('index', 'active'); }
/** * Show the latest announcement * * @return \Illuminate\Http\Response */ public function latest() { $announcement = Announcement::orderBy('publish_at', 'desc')->where('publish_at', '<', date("Y-m-d H:i:s", time()))->where('unpublish_at', '>', date("Y-m-d H:i:s", time()))->limit(1)->get()->first(); if ($announcement) { return $this->item($announcement, new AnnouncementTransformer()); } else { $this->response->noContent(); } }
public function doDelete($id) { $announcement = Announcement::findOrFail($id); try { $announcement->delete(); return redirect()->back()->with('message', 'Announcement has been deleted successfully !'); } catch (ParseException $ex) { echo 'Failed to delete announcement , with error message: ' . $ex->getMessage(); } }
public function index() { $limit = 2; $announcement = Announcement::orderBy('created_at', 'desc')->limit($limit)->get(); $now = new Datetime(); $now = $now->format('Y-m-d'); $upcomingTrainings = Training::where('status', '=', 1)->where('start_date', '>', Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $now . ' 00:00:00'))->orderBy('start_date', 'asc')->limit($limit)->get(); $ongoingTrainings = Training::where('status', '=', 1)->where('start_date', '<=', Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $now . ' 00:00:00'))->where('end_date', '>=', Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $now . ' 00:00:00'))->limit($limit)->get(); $all_slider = Slider::orderBy('position', 'asc')->get(); return view('bard_frontend.index', compact('announcement', 'upcomingTrainings', 'ongoingTrainings', 'all_slider')); }
public static function getAllAnnouncements() { return \App\Announcement::orderBy('id', 'desc')->get(); }
/** * Responds to requests to GET /announcement/delete/{id?} */ public function getDelete($id) { # Get the announcement to be deleted $announcement = \App\Announcement::find($id); if (is_null($announcement)) { \Session::flash('message', 'Announcement not found.'); return redirect('/announcements'); } # Then delete the announcement $announcement->delete(); # Done \Session::flash('message', $announcement->title . ' was deleted.'); return redirect('/announcements'); }
/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { parent::boot($router); // $router->model('user' , 'App\User'); $router->bind('user', function ($value) { return User::with('roles')->findOrFail($value); }); /** * created by dara on 6/9/2015 * add binding for admin wild card */ $router->bind('admin', function ($value) { return User::with('roles')->findOrFail($value); }); /** * Created by Emad Mirzaie on 09/09/2015. * province wild cart */ $router->model('province', 'App\\Province'); $router->model('city', 'App\\Province'); $router->model('university', 'App\\University'); $router->model('article', 'App\\Article'); $router->model('post', 'App\\Post'); $router->model('category', 'App\\Category'); $router->model('sub_category', 'App\\Category'); $router->model('skill', 'App\\Skill'); $router->model('profile', 'App\\User'); $router->model('comment', 'App\\Comment'); $router->model('poll', 'App\\Poll'); $router->model('questionnaire', 'App\\Questionnaire'); $router->model('coupon_user', 'App\\CouponUser'); $router->model('showcase', 'App\\Showcase'); $router->model('sticky', 'App\\Sticky'); /** * Created By Dara on 22/10/2015 */ // $router->bind('offer',function($value){ // return Offer::findOrFail($value); // }); $router->bind('service', function ($value) { return CouponGallery::findOrFail($value); }); $router->bind('coupon', function ($value) { return Coupon::findOrFail($value); }); $router->bind('group', function ($value) { return Group::findOrFail($value); }); $router->bind('problem', function ($value) { return Problem::findOrFail($value); }); $router->model('offer', 'App\\Offer'); $router->model('shop', 'App\\Shop'); $router->model('product', 'App\\Product'); $router->bind('event', function ($value) { return Event::findOrFail($value); }); $router->bind('settle', function ($value) { return Settle::findOrFail($value); }); $router->bind('report', function ($value) { return Report::findOrFail($value); }); $router->bind('corporation', function ($value) { return Corporation::findOrFail($value); }); /** * Created By Dara on 25/12/2015 */ $router->bind('announcement', function ($value) { return Announcement::findOrFail($value); }); $router->bind('storage', function ($value) { return Storage::findOrFail($value); }); $router->bind('role', function ($value) { return Role::findOrFail($value); }); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $announcements = Announcement::all(); return view('dashboard.home.index', ['announcement' => $announcements]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $announcements = Announcement::find($id); $announcements->delete(); Session::flash('message', 'You have successfully deleted announcement'); return Redirect::to('dashboard/admin/announcements'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Request $request, $id) { Announcement::destroy($id); return 'ok'; }
/** * Run the migrations. * * @return void */ public function up() { // Create departement : "autre" Department::create(['name' => 'Autre', 'short_name' => 'PeiP']); // Create departement : DI Department::create(['name' => 'Département Informatique', 'short_name' => 'DI']); // Create departement : DMS Department::create(['name' => 'Département Mécanique', 'short_name' => 'DMS']); // Create user : Admin (lvl 3) User::create(['first_name' => 'Admin', 'last_name' => 'Admin', 'email' => 'admin@admin', 'school_year' => 0, 'department_id' => 1, 'password' => bcrypt('admincmt'), 'level_id' => 4, 'slug' => 'admin-admin-2']); // Create user : Teacher (lvl 2) User::create(['first_name' => 'Teacher', 'last_name' => 'Teacher', 'email' => 'teacher@teacher', 'school_year' => 0, 'department_id' => 1, 'password' => bcrypt('teachercmt'), 'level_id' => 3, 'slug' => 'teacher-teacher-3']); // Create user : band_creator (lvl 1) User::create(['first_name' => 'Band', 'last_name' => 'Creator', 'email' => 'band@creator', 'school_year' => 0, 'department_id' => 1, 'password' => bcrypt('membercmt'), 'level_id' => 2, 'slug' => 'band-creator-5,']); // Create user : Member (lvl 0) User::create(['first_name' => 'Member', 'last_name' => 'Member', 'email' => 'member@member', 'school_year' => 0, 'department_id' => 1, 'password' => bcrypt('membercmt'), 'level_id' => 1, 'slug' => 'member-member-4']); // Create Article 'Cours de guitare' Article::create(['title' => 'Cours de guitare', 'subtitle' => 'Article concernant le cours de guitare', 'content' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam purus tortor, efficitur ut iaculis ut, tincidunt vel elit. Morbi malesuada ipsum eu fermentum consequat. Duis aliquam, massa et bibendum facilisis, nulla nibh ultricies ante, a rutrum augue tellus quis erat. Curabitur aliquam ipsum gravida, interdum mauris non, blandit justo. Donec non mollis orci, a accumsan ligula. Nullam quis sapien elementum neque egestas lacinia</p>', 'user_id' => 2, 'slug' => 'cours-de-guitare-1', 'category_id' => 3, 'validated' => 1]); // Create Article 'Cours de piano' Article::create(['title' => 'Cours de piano', 'subtitle' => 'Article concernant le cours de piano', 'content' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam purus tortor, efficitur ut iaculis ut, tincidunt vel elit. Morbi malesuada ipsum eu fermentum consequat. Duis aliquam, massa et bibendum facilisis, nulla nibh ultricies ante, a rutrum augue tellus quis erat. Curabitur aliquam ipsum gravida, interdum mauris non, blandit justo. Donec non mollis orci, a accumsan ligula. Nullam quis sapien elementum neque egestas lacinia</p>', 'user_id' => 3, 'slug' => 'cours-de-piano-2', 'category_id' => 3, 'validated' => 1]); // Create guitar course Course::create(['name' => 'Cours de guitare', 'day' => 1, 'start' => '18:30:00', 'end' => '20:00:00', 'infos' => 'Cours de guitare du lundi soir.', 'slug' => 'cours-de-guitare-lundi-1', 'instrument_id' => 2, 'article_id' => 1, 'user_id' => 2]); // Create piano course Course::create(['name' => 'Cours de piano', 'day' => 3, 'start' => '18:30:00', 'end' => '20:00:00', 'infos' => 'Cours de piano du mardi soir.', 'slug' => 'cours-de-piano-mardi-2', 'instrument_id' => 3, 'article_id' => 2, 'user_id' => 3]); // Create Band 'The Band' Band::create(['name' => 'The Band', 'infos' => 'premier groupe de test', 'user_id' => 1, 'validated' => 1, 'slug' => 'the-band-1', 'article_id' => 2]); // Create band 'Second Band' Band::create(['name' => 'Second Band', 'infos' => 'deuxieme groupe de test', 'user_id' => 2, 'validated' => 1, 'slug' => 'second-band-2', 'article_id' => 1]); // Create News 'test news' News::create(['title' => 'test news', 'content' => '<p>Contenu de la première news de test</p>', 'user_id' => 1, 'slug' => 'test-news-1']); // Create News 'test second news' News::create(['title' => 'test seconde news', 'content' => '<p>Contenu de la deuxieme news de test</p>', 'user_id' => 2, 'slug' => 'test-seconde-news-1']); // Create announcement 'test d'une annonce' Announcement::create(['user_id' => 1, 'title' => 'test d\'une annonce', 'slug' => 'test-annonce-1', 'validated' => 1, 'subject' => 'Annonce pour tester', 'category_id' => 1, 'content' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque in malesuada leo. Suspendisse ut dapibus urna. Nunc mattis velit vel varius luctus. Fusce ornare arcu nec odio egestas, et lacinia sapien laoreet. Maecenas odio dui, fringilla non sapien euismod, volutpat porta sapien. Suspendisse mauris quam, maximus quis tempus non, feugiat in tellus. Sed non quam aliquet, sollicitudin risus nec, mollis turpis. Donec interdum tincidunt efficitur. Nam efficitur enim a leo pellentesque, venenatis sollicitudin lacus suscipit. Ut eu nunc eget lacus vehicula gravida. Fusce vitae ante bibendum, maximus nisl quis, lacinia metus. In pharetra placerat lacus, sed fringilla ex imperdiet vel. Nulla mollis risus tellus, a ultricies tellus tempor cursus. Quisque viverra nunc ipsum, a ullamcorper dui porttitor eu. Suspendisse nec nunc ut mi dignissim ultrices.</p> <p>In libero sem, dictum in venenatis sit amet, dictum id quam. Aliquam id ligula luctus, lobortis felis eget, sollicitudin nulla. Suspendisse tempus aliquet volutpat. Integer lacinia sem ac libero faucibus cursus. Morbi mauris massa, interdum vel placerat sit amet, rutrum eget turpis. Mauris convallis semper sem, eu pharetra tortor sagittis non. Praesent auctor justo nulla, in rhoncus ipsum porta ut. Mauris bibendum fringilla accumsan. Proin bibendum eros eros. Aliquam vulputate, nisi vitae tristique lacinia, leo risus volutpat augue, vel ultricies lorem urna vitae erat. Vestibulum varius, libero eget sollicitudin luctus, lacus massa molestie purus, quis blandit felis sem at dui.</p>']); // Create announcement 'test d'une seconde annonce' Announcement::create(['user_id' => 2, 'content' => '<p>contenu de la deuxieme annonce</p>', 'title' => 'test d\'une seconde annonce', 'slug' => 'test-seconde-annonce-2', 'validated' => 1, 'subject' => 'Deuxieme annonce pour tester', 'category_id' => 1]); // Create announcement unvalidated Announcement::create(['user_id' => 3, 'content' => '<p>azre</p>', 'title' => 'azr', 'slug' => 'test-annonce-invalidee-3', 'validated' => 0, 'subject' => 'Annonce invalidée pour tester', 'category_id' => 1]); // Create comment on announcement #1 Comment::create(['announcement_id' => 1, 'user_id' => 1, 'content' => '<p>Nam efficitur enim a leo pellentesque, venenatis sollicitudin lacus suscipit. Ut eu nunc eget lacus vehicula gravida. Fusce vitae ante bibendum, maximus nisl quis, lacinia metus. In pharetra placerat lacus, sed fringilla ex imperdiet vel. Nulla mollis risus tellus, a ultricies tellus tempor cursus. Quisque viverra nunc ipsum, a ullamcorper dui porttitor eu. Suspendisse nec nunc ut mi dignissim ultrices.</p> <p>In libero sem, dictum in venenatis sit amet, dictum id quam. Aliquam id ligula luctus, lobortis felis eget, sollicitudin nulla. Suspendisse tempus aliquet volutpat. Integer lacinia sem ac libero faucibus cursus.</p>']); // Create comment on announcement #1 Comment::create(['announcement_id' => 1, 'user_id' => 2, 'content' => '<p>In libero sem, dictum in venenatis sit amet, dictum id quam. Aliquam id ligula luctus, lobortis felis eget, sollicitudin nulla. Suspendisse tempus aliquet volutpat. Integer lacinia sem ac libero faucibus cursus.</p> <p>Nam efficitur enim a leo pellentesque, venenatis sollicitudin lacus suscipit. Ut eu nunc eget lacus vehicula gravida. Fusce vitae ante bibendum, maximus nisl quis, lacinia metus. In pharetra placerat lacus, sed fringilla ex imperdiet vel. Nulla mollis risus tellus, a ultricies tellus tempor cursus. Quisque viverra nunc ipsum, a ullamcorper dui porttitor eu. Suspendisse nec nunc ut mi dignissim ultrices.</p>']); // Create comment on announcement #2 Comment::create(['announcement_id' => 2, 'user_id' => 1, 'content' => '<p>commentaire annonce 2</p>']); // Create Article 'premier article' Article::create(['title' => 'premier article', 'subtitle' => 'test d\'un premier article', 'content' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam purus tortor, efficitur ut iaculis ut, tincidunt vel elit. Morbi malesuada ipsum eu fermentum consequat. Duis aliquam, massa et bibendum facilisis, nulla nibh ultricies ante, a rutrum augue tellus quis erat. Curabitur aliquam ipsum gravida, interdum mauris non, blandit justo. Donec non mollis orci, a accumsan ligula. Nullam quis sapien elementum neque egestas lacinia</p>', 'user_id' => 1, 'slug' => 'premier-article-3', 'category_id' => 2, 'validated' => 1]); // Create Article 'deuxieme article' Article::create(['title' => 'deuxieme article', 'subtitle' => 'test d\'un deuxieme article', 'content' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam purus tortor, efficitur ut iaculis ut, tincidunt vel elit. Morbi malesuada ipsum eu fermentum consequat. Duis aliquam, massa et bibendum facilisis, nulla nibh ultricies ante, a rutrum augue tellus quis erat. Curabitur aliquam ipsum gravida, interdum mauris non, blandit justo. Donec non mollis orci, a accumsan ligula. Nullam quis sapien elementum neque egestas lacinia</p>', 'user_id' => 2, 'slug' => 'deuxieme-article-4', 'category_id' => 1]); // Create Event 'concert de The Band' Event::create(['location' => '23 avenue de la Team Musique', 'day' => 6, 'start' => '18:00:00', 'end' => '00:00:00', 'infos' => 'infos du premier event', 'name' => 'Concert de The Band', 'slug' => 'concert-the-band', 'user_id' => 1, 'date' => '2016-03-27', 'article_id' => 1]); // Create Event 'concert de ouf' Event::create(['location' => '186 avenue de la Team Musique', 'day' => 5, 'start' => '17:00:00', 'end' => '23:00:00', 'infos' => 'infos du deuxieme event', 'name' => 'Concert de ouf', 'slug' => 'concert-de-ouf', 'user_id' => 2, 'date' => '2016-04-12', 'article_id' => 2]); // Associate Band 1 to Event 1 BandEvent::create(['band_id' => 1, 'event_id' => 1]); // Associate band 1 to event 2 BandEvent::create(['band_id' => 1, 'event_id' => 2]); // Associate band 2 to event 2 BandEvent::create(['band_id' => 2, 'event_id' => 2]); // Associate Members to Bands BandUser::create(['user_id' => 1, 'band_id' => 1, 'instrument_id' => 1]); BandUser::create(['user_id' => 2, 'band_id' => 1, 'instrument_id' => 2]); BandUser::create(['user_id' => 3, 'band_id' => 1, 'instrument_id' => 3]); BandUser::create(['user_id' => 2, 'band_id' => 2, 'instrument_id' => 5]); BandUser::create(['user_id' => 3, 'band_id' => 2, 'instrument_id' => 10]); // Associate Users to Courses as Students CourseUser::create(['user_id' => '1', 'course_id' => 1, 'validated' => 1, 'level' => 0]); CourseUser::create(['user_id' => '3', 'course_id' => 1, 'validated' => 1, 'level' => 0]); CourseUser::create(['user_id' => '1', 'course_id' => 2, 'validated' => 1, 'level' => 0]); CourseUser::create(['user_id' => '4', 'course_id' => 2, 'validated' => 0, 'level' => 0]); // Associate Users to Courses as Teachers CourseUser::create(['user_id' => '3', 'course_id' => 1, 'validated' => 1, 'level' => 1]); CourseUser::create(['user_id' => '2', 'course_id' => 1, 'validated' => 1, 'level' => 1]); CourseUser::create(['user_id' => '2', 'course_id' => 2, 'validated' => 1, 'level' => 1]); CourseUser::create(['user_id' => '4', 'course_id' => 1, 'validated' => 0, 'level' => 1]); // Course Modification tests CourseModification::create(['author_id' => 1, 'user_id' => 1, 'course_id' => 1, 'value' => 0]); CourseModification::create(['author_id' => 2, 'user_id' => 2, 'course_id' => 1, 'value' => 1]); CourseModification::create(['author_id' => 1, 'user_id' => 3, 'course_id' => 2, 'value' => 2]); CourseModification::create(['author_id' => 3, 'user_id' => 2, 'course_id' => 2, 'value' => 3]); }
public function destroy(Request $request) { $model = Announcement::find($request->id); if (empty($model)) { Flash::error('Impossible de supprimer cette annonce.'); return Redirect::back(); } $model->delete(); Flash::success('L\'annonce a bien été supprimée.'); return redirect('announcements/list'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $announcement = Announcement::whereid($id)->firstOrFail(); $announcement->delete(); return redirect('/announcements')->with('status', 'The announcement information has been deleted!'); }
Route::get('decline-service-request/{id}', ['as' => 'amDeclinePendingServiceRequest', 'uses' => 'AM\\ReportController@declinePendingServiceRequest']); }); // Medical Rep. Section Route::group(['prefix' => 'mr', 'middleware' => 'mr'], function () { // Medical Rep. Dashboard Route::get('test-coverage/{id}', ['as' => 'specialtyCoverageStats', 'uses' => 'MR\\LineController@specialtyCoverageStats']); Route::get('test-sales/{id}/{month}', ['as' => 'monthlyDirectSales', 'uses' => 'MR\\LineController@monthlyDirectSales']); Route::get('test-target', ['uses' => 'MR\\LineController@target']); Route::get('dashboard', ['as' => 'mr', function () { $coverageStats = Employee::coverageStats(\Auth::user()->id, date('M-Y')); $totalProducts = Employee::monthlyDirectSales(\Auth::user()->id, date('M-Y')); $reports = Report::where('mr_id', \Auth::user()->id)->where('month', date('M-Y')); $monthlyReports = $reports->get(); $monthlyFollowsUp = $reports->whereNotNull('follow_up')->get(); $doctors = Customer::where('mr_id', \Auth::user()->id)->get(); $announcements = Announcement::where('level_id', 7)->where('start', '>=', date('Y-m-d'))->where('end', '<=', date('Y-m-d', strtotime('+1 week')))->get(); $dataView = ['doctors' => count($doctors), 'totalVisitsCount' => $coverageStats['totalVisitsCount'], 'actualVisitsCount' => $coverageStats['actualVisitsCount'], 'totalMonthlyCoverage' => $coverageStats['totalMonthlyCoverage'], 'totalSoldProductsSalesPrice' => $totalProducts['totalSoldProductsSalesPrice'], 'monthlyReports' => $monthlyReports, 'monthlyFollowsUp' => $monthlyFollowsUp, 'announcements' => $announcements]; return view('mr.index', $dataView); }]); //Profile Route::get('profile', ['as' => 'mrProfile', 'uses' => 'AuthController@editMRProfile']); Route::post('profile', ['as' => 'postMRProfile', 'uses' => 'AuthController@postEditMRProfile']); // Message Route::get('all-messages', ['as' => 'mrInbox', 'uses' => 'MR\\InboxController@all']); Route::get('sent-messages', ['as' => 'mrSentMessages', 'uses' => 'MR\\InboxController@sent']); Route::get('create-message', ['as' => 'mrCreateMessage', 'uses' => 'MR\\InboxController@create']); Route::post('create-message', ['as' => 'mrDoCreateMessage', 'uses' => 'MR\\InboxController@doCreate']); Route::get('show-message/{id}', ['as' => 'mrShowMessage', 'uses' => 'MR\\InboxController@show']); Route::post('reply/{id}', ['as' => 'mrDoReply', 'uses' => 'MR\\InboxController@doReply']); // Distributors Route::get('distributors', ['as' => 'mrDistributors', 'uses' => 'MR\\ProductController@listAllDistributors']);