|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Models\Slider;
|
|
|
|
use App\Models\Testimonial;
|
|
|
|
use App\Models\NewsAndUpdate;
|
|
|
|
use App\Models\Subscription;
|
|
|
|
use App\Models\AboutUs;
|
|
|
|
|
|
|
|
class HomeController extends Controller
|
|
|
|
{
|
|
|
|
public function index(){
|
|
|
|
$sliders = Slider::where('status',1)->get();
|
|
|
|
$testimonials = Testimonial::where('status',1)->get();
|
|
|
|
$blogs = NewsAndUpdate::where('status',1)->get();
|
|
|
|
$about_us = AboutUs::where('status',1)->get();
|
|
|
|
return view('welcome',compact('sliders','testimonials','blogs','about_us'));
|
|
|
|
}
|
|
|
|
public function subscribe(Request $request)
|
|
|
|
{
|
|
|
|
|
|
|
|
$email = $request->email;
|
|
|
|
$subscription = new Subscription();
|
|
|
|
$subscription->email = $email;
|
|
|
|
$subscription->save();
|
|
|
|
|
|
|
|
|
|
|
|
\Mail::send('subscribe_mail', array(
|
|
|
|
|
|
|
|
|
|
|
|
'email' =>\request('email'),
|
|
|
|
|
|
|
|
|
|
|
|
'subject' => 'Subscription Notice',
|
|
|
|
|
|
|
|
), function($message) use ($request){
|
|
|
|
$subject = 'Subscription Notice';
|
|
|
|
$message->subject('Subscription Notice');
|
|
|
|
|
|
|
|
$message->to('admin@eteducation.com.au', 'Et-Visa')->subject($subject);
|
|
|
|
$message->cc('extratechweb@gmail.com', 'Extratech')->subject($subject);
|
|
|
|
$message->cc('suman@extratechs.com.au', 'Extratech')->subject($subject);
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
return response()->json(['success' => 'Successfully subscribed!','status' =>'Ok'],200);
|
|
|
|
}
|
|
|
|
}
|