public function index() { $founders = TeamMember::where('title', '=', 'The Original Spartan Martin')->get(); $founder = (object) (isset($founders[0]) ? $founders[0]->toArray() : []); // dd($founder); return view('pages/index', compact('founder')); }
public function store(ContactFormRequest $request) { $route = Helpers::routeinfo(); $from = [$request->get('email'), ucwords($request->get('name'))]; $to = ['*****@*****.**', 'Acclaim Events']; $subj = 'Contact Form Submission'; if (count($route->params) === 1) { $member = TeamMember::where('first_name', '=', ucwords($route->params['contact']))->take(1)->get(); if (isset($member[0])) { $member = (object) $member[0]->toArray(); $to = [$member->email, $member->first_name . ' ' . $member->last_name]; $subj = 'Personal Contact request for ' . $member->first_name . ' ' . $member->last_name; } } $contact = ['from' => $from, 'to' => $to, 'subj' => $subj]; \Mail::send('emails/contact', ['name' => $request->get('name'), 'email' => $request->get('email'), 'phone' => $request->get('phone'), 'msg' => $request->get('message')], function ($message) use($contact) { $fromEmail = $contact['from'][0]; $fromName = $contact['from'][1]; $toEmail = $contact['to'][0]; $toName = $contact['to'][1]; $subject = $contact['subj']; $message->from($fromEmail, $fromName); $message->to($toEmail, $toName)->subject($subject); }); return back()->with('message', 'Thanks for contacting us!'); }
/** * Run the migrations. * * @return void */ public function up() { // Schema::create('team_members', function (Blueprint $table) { $table->increments('id'); $table->string('first_name'); $table->string('last_name'); $table->string('slug'); $table->string('title'); $table->string('email'); $table->text('bio')->nullable(); $table->integer('priority'); $table->string('photo')->nullable(); $table->timestamps(); $table->timestamp('published')->nullable(); $table->softDeletes(); }); TeamMember::create(['first_name' => 'Alex', 'last_name' => 'Kaneen', 'slug' => 'kaneen-alex', 'title' => 'President & CEO', 'email' => '*****@*****.**', 'priority' => 1, 'photo' => '/images/team/kaneen-alex.jpg', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]); TeamMember::create(['first_name' => 'Bob', 'last_name' => 'Fritz', 'slug' => 'fritz-bob', 'title' => 'Senior Vice President', 'email' => '*****@*****.**', 'priority' => 2, 'photo' => '/images/team/fritz-bob.jpg', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]); TeamMember::create(['first_name' => 'Jeff', 'last_name' => 'Martin', 'slug' => 'martin-jeff', 'title' => 'VP Business Development', 'email' => '*****@*****.**', 'priority' => 3, 'photo' => '/images/team/martin-jeff.jpg', 'published' => Carbon::create(2015, 00, 28, 15, 05, 29)]); }
public function run() { DB::table('team_members')->delete(); /* Schema::create('team_members', function(Blueprint $table) { $table->increments('id'); $table->string('first_name'); $table->string('last_name'); $table->string('title'); $table->string('email'); $table->string('facebook')->nullable(); $table->string('twitter')->nullable(); $table->string('linkedin')->nullable(); $table->string('googleplus')->nullable(); $table->string('treehouse')->nullable(); $table->string('codeacademy')->nullable(); $table->text('about')->nullable(); $table->timestamps(); $table->timestamp('published_at')->nullable(); $table->softDeletes(); }); protected $fillable = [ 'first_name', 'last_name', 'title', 'email', 'facebook', 'twitter', 'linkedin', 'googleplus', 'treehouse', 'codeacademy', 'about', 'published_at', ]; */ TeamMember::create(['first_name' => 'Jeff', 'last_name' => 'Martin', 'title' => 'The Original Spartan Martin', 'email' => '*****@*****.**', 'linkedin' => '/in/spartanmartin', 'treehouse' => '/jeffmartin', 'published_at' => Carbon::now()]); }
public function remove($teamMemberId, RemoveTeamMember $request) { return TeamMember::where(['id' => $teamMemberId])->delete(); }