示例#1
0
 public function showForm(Request $request)
 {
     if ($request->user()->role == 'user') {
         return redirect()->back();
     }
     $subscribers = Subscriber::all();
     return view('breaks.create')->with('subscribers', $subscribers);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $subscribers = Subscriber::all();
     foreach ($subscribers as $subscriber) {
         $uuid = hashSubscriber($subscriber->id);
         $subscriber->uuid = $uuid;
         $subscriber->save();
     }
 }
 public function testUnrecognizedCommand()
 {
     $subscriber = $this->createSubscriber();
     $this->assertCount(1, Subscriber::all());
     $response = $this->call('POST', route('subscribers.register'), ['From' => '555-5555', 'Body' => 'command']);
     $twilioResponse = new SimpleXMLElement($response->getContent());
     $this->assertContains('Sorry', strval($twilioResponse->Message));
     $this->assertCount(1, Subscriber::all());
 }
示例#4
0
 /**
  * Получить все перерывы для определенного подписчика или для всех сразу
  *
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function getBreaks(Request $request)
 {
     $dayToShow = Carbon::createFromFormat('d.m.Y', $request->input('dayToShow'))->toDateString();
     if ($request->has('subscriber')) {
         $subscriber = $request->input('subscriber');
         return response()->json(Schedule::getBreaksByIdAndDate($subscriber, $dayToShow));
     } else {
         $subscribers = Subscriber::all();
         $breaks = Schedule::getBreaksByDate($dayToShow);
         return response()->json(compact('breaks', 'subscribers'));
     }
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     //We first get the all data from our subscribers//database
     $subscribers = Subscriber::all();
     //             dd($subscribers);
     foreach ($subscribers as $subscriber) {
         //Now we send an email to each subscriber
         Mail::queue('emails.thankyou', [$subscriber->email], function ($message) use($subscriber) {
             $message->from('*****@*****.**', 'Our Name');
             $message->to($subscriber->email, $name = null);
         });
     }
     $this->delete();
     return 'DONE';
 }
 /**
  * Send news letter
  *
  * @return Response
  */
 public function sendNewsLetter()
 {
     if (\Request::ajax()) {
         $data = Input::all();
         $transport = \Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')->setUserName('*****@*****.**')->setPassword('0771950394');
         $mailler = \Swift_Mailer::newInstance($transport);
         $subscribers = Subscriber::all();
         foreach ($subscribers as $s) {
             $message = \Swift_Message::newInstance()->setSubject(Input::get('subject'))->setFrom('*****@*****.**', 'Amalya Reach')->setTo($s->email)->setBody(Input::get('body'), 'text/html');
             $numSent = $mailler->send($message);
         }
         printf("Sent %d messages\n", $numSent);
     }
 }
 /**
  * Список всех подписчиков
  *
  * @return $this
  */
 public function index()
 {
     $subscribers = Subscriber::all();
     return view('subscribers.list')->with('subscribers', $subscribers);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $subscribers = Subscriber::all();
     return view('admin.subscribers.index')->withSubscribers($subscribers);
 }
示例#9
0
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::get('ce', function () {
    return \Carbon\Carbon::createFromDate(2014, 07, 22)->toDateTimeString();
    return \App\Subscriber::all();
});
Route::group(['middleware' => ['web']], function () {
    Route::get('/', 'PageController@home');
    Route::get('/profile', 'PageController@profile');
    Route::get('/question/{id}-{slug}', 'PageController@question');
});
Route::group(['middleware' => 'web'], function () {
    Route::auth();
    Route::get('/home', 'HomeController@index');
    Route::get('/question', 'HomeController@questions');
    Route::get('/play', 'HomeController@play');
});