Initial commit to new repo
This commit is contained in:
parent
a267f9bfcc
commit
a5173c981b
292 changed files with 17472 additions and 0 deletions
49
app/Http/Controllers/ContactsController.php
Normal file
49
app/Http/Controllers/ContactsController.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Contact;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class ContactsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show all the contacts.
|
||||
*
|
||||
* @return \Illuminate\View\Factory view
|
||||
*/
|
||||
public function showAll()
|
||||
{
|
||||
$filesystem = new Filesystem();
|
||||
$contacts = Contact::all();
|
||||
foreach ($contacts as $contact) {
|
||||
$contact->homepagePretty = parse_url($contact->homepage)['host'];
|
||||
$file = public_path() . '/assets/profile-images/' . $contact->homepagePretty . '/image';
|
||||
$contact->image = ($filesystem->exists($file)) ?
|
||||
'/assets/profile-images/' . $contact->homepagePretty . '/image'
|
||||
:
|
||||
'/assets/profile-images/default-image';
|
||||
}
|
||||
|
||||
return view('contacts', ['contacts' => $contacts]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a single contact.
|
||||
*
|
||||
* @return \Illuminate\View\Factory view
|
||||
*/
|
||||
public function showSingle($nick)
|
||||
{
|
||||
$filesystem = new Filesystem();
|
||||
$contact = Contact::where('nick', '=', $nick)->firstOrFail();
|
||||
$contact->homepagePretty = parse_url($contact->homepage)['host'];
|
||||
$file = public_path() . '/assets/profile-images/' . $contact->homepagePretty . '/image';
|
||||
$contact->image = ($filesystem->exists($file)) ?
|
||||
'/assets/profile-images/' . $contact->homepagePretty . '/image'
|
||||
:
|
||||
'/assets/profile-images/default-image';
|
||||
|
||||
return view('contact', ['contact' => $contact]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue