本文整理汇总了PHP中app\Contact::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::all方法的具体用法?PHP Contact::all怎么用?PHP Contact::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Contact
的用法示例。
在下文中一共展示了Contact::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index(Request $request)
{
if ($request->wantsJson()) {
return Contact::all();
}
return view('template');
}
示例2: run
public function run()
{
$contacts = Contact::all();
$campaign = Campaign::where('name', '=', 'Halloween Video')->first();
foreach ($contacts as $contact) {
Email::create(['send_on' => Carbon::now()->addMinutes(5), 'template' => 'emails.halloween', 'subject' => 'Happy Halloween!', 'draft' => false, 'campaign_id' => $campaign->id, 'contact_id' => $contact->id]);
}
}
示例3: showMessages
function showMessages()
{
if (isset($_SESSION['authorization']) && $_SESSION['authorization'] == 1) {
$contacts = Contact::all();
return view('users.lookContacts', ['contacts' => $contacts]);
} else {
return Redirect::to('./sayfa-bulunamadi');
}
}
示例4: __construct
public function __construct()
{
$templates = Touch::all()->each(function ($touch) {
$client = $touch->campaign->client->name;
$campaign = $touch->campaign->name;
$title = $touch->title;
$touch->myValue = "{$client} | {$campaign} | {$title}";
})->lists('myValue', 'id')->sort();
$contactFields = array_keys(Contact::all()->first()->toArray());
view()->share(['templates' => $templates, 'contactFields' => $contactFields]);
}
示例5: run
public function run()
{
$contacts = \App\Contact::all();
$companies = \App\Company::all();
for ($i = 0; $i < 20; $i++) {
try {
$contacts->random()->companies()->attach($companies->random());
} catch (\Exception $e) {
}
}
}
示例6: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
// $contact = new Contact;
// $contact->fullName = 'Piyush Chauhan';
// $contact->email = 'piyushchauhan2011@gmail.com';
// $contact->role = 'Teacher';
// $contact->schoolName = 'University of Sydney';
// $contact->message = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
// $contact->save();
$contacts = Contact::all();
return response()->json($contacts);
}
示例7: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$contacts = Contact::all();
// [
// ['Blog(coming soon)',''],
// ['Facebook','https://www.facebook.com/#/Rainlonely'],
// ['Twitter','https://twitter.com/rainwr'],
// ['Github','https://github.com/Rainlonely'],
// ['G+','https://plus.google.com/u/0/+RainWu'],
// ['Weibo','http://weibo.com/rainlonely'],
// ['Linkedin','https://cn.linkedin.com/in/rain-wu-56523824']
// ];
return view('contact', compact('contacts'));
}
示例8: makeExcel
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function makeExcel()
{
Excel::create('Company List', function ($excel) {
$excel->sheet('companies', function ($sheet) {
$data = Contact::all();
$data = json_decode(json_encode($data), true);
$companies = [];
foreach ($data as $key => $value) {
$company['Company'] = $value['company'];
$company['Sector'] = $value['sector'];
$company['Contact Person'] = $value['contact_person'];
$company['Email'] = $value['email'];
$company['Phone No'] = $value['phone_no'];
$company['Location'] = $value['location'];
$companies[] = $company;
}
$sheet->fromArray($companies);
});
})->download('xlsx');
}
示例9: saveEmail
/**
* Fungsi untuk Save reply yang admin kirim
* @param int $id
*/
public function saveEmail(Request $request)
{
$testing = Contact::latest()->first();
$pesan = new Pesan();
$pesan->email = $request->get('email');
$pesan->name = $request->get('name');
$pesan->message = $request->get('message');
$pesan->save();
$reply = Pesan::latest()->first();
Mail::send('emails.reply', ['reply' => $reply], function ($message) use($reply) {
$message->to($reply->email)->subject('Membalas Pertanyaan Anda');
});
$user = Auth::user();
$contact = Contact::all();
$count = DB::table('pesans')->count();
$count2 = DB::table('contacts')->count();
return Redirect('admin')->with('user', 'contact', 'count', 'count2');
}
示例10: getContact
public function getContact()
{
return view('store.contact')->with('contacts', Contact::all());
}
示例11: contact
public function contact()
{
$contact_model = Contact::all();
return view('main.contact', ['model' => $contact_model]);
}
示例12: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$contact = Contact::find($id);
$contact->delete();
return json_encode(Contact::all());
}
示例13: function
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for 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.
|
*/
use App\Contact;
Route::get('/', function () {
$isInstall = Schema::hasTable('contacts');
if (!$isInstall) {
Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true]);
}
$contacts = Contact::all();
return view('contacts')->with('contacts', $contacts);
});
Route::post('/', function () {
Contact::create(Input::all());
return back();
});
Route::get('/{id}/delete', function ($id) {
$contact = Contact::find($id);
$contact->delete();
return back();
});
示例14: AdminDownloadCsv
public function AdminDownloadCsv()
{
// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=data.csv');
// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');
// output the column headings
fputcsv($output, array('Network', 'Name', 'Screen Name'));
$allcontact = Contact::all();
foreach ($allcontact as $key => $value) {
$row = array('network' => $value['network'], 'name' => $value['name'], 'screen_name' => $value['screen_name']);
fputcsv($output, $row);
}
die;
}
示例15: index
public function index()
{
$contacts = Contact::all();
return view('tries.contacts.index', compact('contacts'));
}