I have a Laravel 8 project. In this project, I wanted to pull the creators profile page from Algolia. That's why I integrated Algolia into the project. However, previously this creator profile pages worked in a different way. Then I integrated Algolia and started getting some errors because the names of the parts coming from Algolia and the parts coming from the old system differ. I started to fix these parts, but no matter what I did in one part, I couldn't handle it. I don't understand what mistake I am making because everything seems to be correct.
CreatorController
public function show($username)
{
$client = SearchClient::create(
env('ALGOLIA_APP_ID'),
env('ALGOLIA_SECRET'),
);
$indexUsers = $client->initIndex("users");
$creatorData = $indexUsers->search($username);
$creator = $creatorData["hits"][0] ?? null;
if(count($creatorData["hits"]) == 0 || !isset($creator)){
abort(404);
}
$indexContent = $client->initIndex("courses");
$contentData = $indexContent->search($username);
$contents = $contentData["hits"] ?? [];
if(count($contentData["hits"]) == 0 || !isset($contents)){
abort(404);
}
return view('creators.show',[
'creator' => (object)$creator,
'contents' => $contents,
]);
}
OLD show.blade.php - content section
#if($creator->contents->isNotEmpty())
<div class="bg-pippin p-8 rounded-lg">
<h4 class="text-2xl leading-8 font-semibold mb-8">Courses from the Author </h4>
<div class="space-y-8">
#foreach($creator->contents as $content)
<div class="flex items-center justify-between flex-col md:flex-row space-x-8">
#if($content->cover!=null)
<div class="w-full md:w-3/12 lg:w-2/6 mb-4 lg:mb-0">
<img src="{{ $content->cover }}" alt="{{ $content->name }}">
</div>
#endif
<div class="w-full md:w-9/12 lg:w-4/6">
<h3 class="font-argent text-4xl font-bold mb-6">{{ $content->name }}</h3>
#foreach($content->categories as $category)
<div class="inline-flex items-center px-3 py-2 rounded bg-soft-text mb-5">
<img src="https://app.omnicourse.io/{{ $category->icon}}" alt="">
<span class="text-base leading-6 font-normal text-white ml-2">{{ $category->name }}</span>
</div>
#endforeach
<div class="flex items-center space-x-6">
<div class="flex items-center">
<img src="/assets/images/icon-clock-black.svg" alt="">
<span class="text-sm md:text-base leading-6 font-normal ml-1">{{ $content->getLengthHours() }} hrs</span>
</div>
<div class="flex items-center">
<img src="/assets/images/icon-list-black.svg" alt="">
<span class="text-sm md:text-base leading-6 font-normal ml-1">{{ count($content->lectures) }} Lessons</span>
</div>
<!--div class="flex items-center">
<img src="/assets/images/icon-like-black.svg" alt="">
<span class="text-sm md:text-base leading-6 font-normal ml-1">96%</span>
</div -->
</div>
</div>
</div>
#endforeach
</div>
</div>
#endif
NEW show.blade.php - content section
#if(count($contents) > 0)
<div class="bg-pippin p-8 rounded-lg">
<h4 class="text-2xl leading-8 font-semibold mb-8">Courses from the Author </h4>
<div class="space-y-8">
#foreach($contents as $content)
<div class="flex items-center justify-between flex-col md:flex-row space-x-8">
#if($content['cover']!=null)
<div class="w-full md:w-3/12 lg:w-2/6 mb-4 lg:mb-0">
<img src="{{ $content['cover'] }}" alt="{{ $content['name'] }}">
</div>
#endif
<div class="w-full md:w-9/12 lg:w-4/6">
{{-- <h3 class="font-argent text-4xl font-bold mb-6">{{ $content->name }}</h3> --}}
#foreach($contents as $categorys)
<div class="inline-flex items-center px-3 py-2 rounded bg-soft-text mb-5">
<img src="https://app.omnicourse.io/{{ $categorys['icon'] }}" alt="">
<span class="text-base leading-6 font-normal text-white ml-2">{{ $category['name'] }}</span>
</div>
#endforeach
<div class="flex items-center space-x-6">
<div class="flex items-center">
<img src="/assets/images/icon-clock-black.svg" alt="">
<span class="text-sm md:text-base leading-6 font-normal ml-1">{{ $content->getLengthHours() }} hrs</span>
</div>
<div class="flex items-center">
<img src="/assets/images/icon-list-black.svg" alt="">
<span class="text-sm md:text-base leading-6 font-normal ml-1">{{ count($content->lectures) }} Lessons</span>
</div>
</div>
</div>
</div>
#endforeach
</div>
</div>
#endif
Data from Algolia and their names
{
"id": 114,
"user_id": 741,
"isLearnBite": 0,
"name": "Funding Your Business",
"cover": "https://omnicoursewebsites.s3.eu-west-2.amazonaws.com/courses/114/images/cover/769312_1643628130.jpg",
"color": "#fefefe",
"description": "Funding Your Business",
"short_description": "Funding Your Business",
"length": 5293,
"order": 0,
"status_id": 1,
"created_at": "2022-01-28T09:19:31.000000Z",
"updated_at": "2022-01-31T11:22:22.000000Z",
"custom_fields": {
"dynamic_link": "https://omnicourse.page.link/cQgs9TcoPen1J6dZ8"
},
"lectures_count": 22,
"lecturer_name": "Adam Shaw",
"lecturer_username": "adamshaw",
"lecturer_avatar": "https://omnicoursewebsites.s3.eu-west-2.amazonaws.com/creator_thumbnail/741/2022-03-29/thumbnail_400X400_565720_1640103825.jpg",
"tags": [
1,
30,
43,
73
],
"categories": [
2
],
"last_listened_data": null,
"user_rating": 0,
"isFavorited": false,
"isBookMarked": false,
"isCompleted": false,
"creator_profile": {
"name": "Adam Shaw",
"username": "adamshaw",
"avatar": "https://omnicoursewebsites.s3.eu-west-2.amazonaws.com/creator_thumbnail/741/2022-03-29/thumbnail_400X400_565720_1640103825.jpg",
"about": "What is important in life?\r\n\r\nI have asked myself this question for as long as I can remember. My path has been varied and fun, which for me is what makes life good.\r\n\r\nMy key expertise is working with energy and mind-body medicine. I also have a more recent background in funding and business consultancy.\r\n\r\nFor 13 years I worked as a nurse, developing key skills and awareness in counselling the dying and their families. Through discussing what was important in life with thousands of people close to death, I noticed certain patterns amongst the regrets and achievements of those close to death. \r\n\r\nIt also led me to discovering energy medicine through Reiki, Vortex Healing and Energetic NLP. This, in turn, led to a path into Mind-Body medicine.\r\n\r\nWhat does all of that mean for you though?\r\n\r\nIf you want to use your mind to improve your wellbeing, I can help. \r\n\r\nIf you are questioning your purpose on the planet, I can facilitate that journey.\r\n\r\nIf you are a company owner looking for help with funding, I can point you in the right direction.",
"custom_fields": {
"youtube": "https://www.youtube.com/c/AdamShawTheHeartGuy",
"linkedin": "https://www.linkedin.com/in/adamshawtheheartguy/",
"instagram": "https://www.instagram.com/the_heart_guy_/",
"twitter": "https://twitter.com/adam_shaw",
"website": "adamshaw.co",
"email_octopus_id": "ce1b2106-69ec-11ec-96e5-06b4694bee2a",
"email_octopus_last_update": "2022-03-26 00:46:46",
"avatar_thumb_400*400": "https://omnicoursewebsites.s3.eu-west-2.amazonaws.com/creator_thumbnail/741/2022-03-29/thumbnail_400X400_565720_1640103825.jpg"
}
},
"_tags": [
"App\\Course::114"
],
"objectID": "App\\Course::114"
}
Related
So I have popup which contains a form that shows a table with editable cells using livewire and each row has a delete button, above this table is a button to add a new empty row to the table. Editing in the cells is working (click the cell and it changes to the inline edit input) but clicking the delete link does nothing and neither does the add link.
So for this process I have the following in the client index file which loads the popup modal when the button to edit the client is clicked.
For this question I am looking at why the add isn't working but as for the delete that would be a bonus!
<script>
$(document).ready(function() {
$("#clients tbody").on("click", ".actions", function () {
var data = table.row( $(this).parents('tr') ).data();
// now call ajax on this url
call_ajax( "/client/" + data[0] + "/edit" );
loader.style.display = "block";
modal.style.display = "block";
});
});
function call_ajax( url ) {
// ToDo make an actual ajax call to get the form data
$.get( url )
.done(
function( data ) {
$("#content-region").html( data );
}
)
.fail(
function() {
$("#content-region").html( "<p>error</p>" );
}
);
}
</script>
So using this when a client has its action section clicked then a call to client/{x}/edit is called which is calls my edit.blade.php file:
#extends('layouts.popup')
#section('header')
<i class="fa fa-fw fa-pencil-square-o fa-lg text-success"></i> Edit Client
#stop
#section('content')
<div class="client-editor">
<form class="admin-link" method="post" action="client/save">
#csrf
<input type="hidden" name="id" value="{{ old( 'id', $client->id ) }}">
<div class="max-w-10xl mx-auto py-10 sm:px-6 lg:px-8">
<div class="md:grid md:grid-cols-3 md:gap-6">
<div class="md:col-span-1 flex justify-between">
<div class="px-4 sm:px-0">
<h3 class="text-lg font-medium text-gray-900">Client Edit</h3>
<p class="mt-1 text-sm text-gray-600">
Update the Client title, you can add and remove contacts below.
</p>
</div>
<div class="px-4 sm:px-0">
</div>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="px-4 py-5 bg-white sm:p-6 shadow sm:rounded-tl-md sm:rounded-tr-md">
<!-- Eclipse Account Handler -->
<div class="col-span-6 sm:col-span-4">
<label class="block font-medium text-sm text-gray-700" for="client_id">
Client Title
</label>
<input
class="border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm mt-1 block w-full"
id="title"
name="title"
type="text"
value="{{ $client->title }}"
>
</div>
<br>
<div class="col-span-6 sm:col-span-4">
<x-toggle
left="No"
right="Yes"
name="is_enabled"
label="Is this client active?"
colourleft="#805050"
colourright="#508050"
default="{{ $client->is_enabled }}"
/>
</div>
</div>
<div class="hidden sm:block">
<div class="py-8">
<div class="border-t border-gray-200"></div>
</div>
</div>
</div>
</div>
</div>
<!-- client contacts -->
<div class="max-w-10xl mx-auto py-10 sm:px-6 lg:px-8">
<div class="md:grid md:grid-cols-3 md:gap-6">
<div class="md:col-span-1 flex justify-between">
<div class="px-4 sm:px-0">
<h3 class="text-lg font-medium text-gray-900">Client Contacts</h3>
<p class="mt-1 text-sm text-gray-600">
Enter details for client contacts assigned to this client.
</p>
</div>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="px-4 py-5 bg-white sm:p-6 shadow sm:rounded-tl-md sm:rounded-tr-md">
#livewire("contacts-table", [ 'client' => $client ])
</div>
<div
class="flex items-center justify-end px-4 py-3 bg-gray-50 text-right sm:px-6 shadow sm:rounded-bl-md sm:rounded-br-md">
<button
type="submit"
class="inline-flex items-center px-4 py-2 bg-gray-800 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-gray-700 active:bg-gray-900 focus:outline-none focus:border-gray-900 focus:ring focus:ring-gray-300 disabled:opacity-25 transition"
>
Save
</button>
</div>
<div class="hidden sm:block">
<div class="py-8">
<div class="border-t border-gray-200"></div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
#stop
and from in this a call of #livewire("contacts-table", [ 'client' => $client ]) and this are it's parts.
ContactsTable.php
<?php
namespace App\Http\Livewire;
use App\Models\Client;
use App\Models\ClientContact;
use Livewire\Component;
class ContactsTable extends Component
{
protected $listeners =['refresh' => '$refresh'];
public Client $client;
public $clientContacts;
public function mount( Client $client )
{
$this->clientContacts = ClientContact::where( 'client_id', $client->id )->get();
}
public function render()
{
return view('livewire.contacts-table');
}
public function addNewContact()
{
die('Test that we got here!'); // I actually have a breakpoint here.
}
}
and contacts-table.blade.php:
<div class="col-span-6 sm:col-span-4">
<a
class="inline-flex items-center px-4 py-2 bg-gray-800 dark:bg-gray-100 dark:text-gray-800 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-gray-700 active:bg-gray-900 focus:outline-none focus:border-gray-900 focus:ring focus:ring-gray-300 disabled:opacity-25 transition"
wire:click="addNewContact"
>
{{ __('Add') }}
</a>
<table id="contacts" class="table table-striped table-bordered table-hover">
<thead>
<td>Name</td>
<td>Email</td>
<td>Phone</td>
<td>Action</td>
</thead>
<tbody>
#foreach( $clientContacts as $contact )
<tr id="{{ $contact->id }}">
<td>
#livewire( 'inline-edit', ['item' => $contact, 'type' => 'title', 'number' => $client->id] )
</td>
<td>
#livewire( 'inline-edit', ['item' => $contact, 'type' => 'email', 'number' => $client->id] )
</td>
<td>
#livewire( 'inline-edit', ['item' => $contact, 'type' => 'phone_number', 'number' => $client->id] )
</td>
<td class="width-8">
<a
class="cursor-pointer"
wire:click="$emit( 'openModal', 'delete-contact',{{ json_encode(['contact_id' => $contact->id]) }} )"
>
<i class="fas fa-trash"></i>
</a>
</td>
</tr>
#endforeach
</tbody>
</table>
<p class="mt-1 text-sm text-gray-600">
Edit the cells above, click the bin to delete or the + to add a new row to populate with a new contact.
</p>
</div>
for completeness here is the popup layout blade file:
<!-- Page Heading-->
<header class="bg-white shadow">
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
#yield('header')
</h2>
</div>
</header>
<!-- Page Content -->
<main>
#if (Session::has('message'))
<!-- will be used to show any messages -->
<div class="alert alert-info">{{ Session::get('message') }}</div>
#endif
<div class="py-12">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
#yield('content')
</div>
</div>
</main>
<!-- End Popup -->
Just to reiterate, the popup form is loading and the content in it is rendered correctly. The top part of the form works so the client is updated.
The inline edit livewire is working (well kind of as I've yet to implement the actual save of it's data but that isn't my issue.
The add button does nothing and nothing is shown in my dev toolbar (no network activity and nothing in the console tab) this is also the case with the delete buttons (which i have working elsewhere in the app - it should show a confirm box and if yes it then removes the contact.
thanks
*** EDIT ***
As an afterthought I have tried this with the client table commented ( the entire table in contacts-table.blade.php) so it just has the add link but it still doesn't work.
*** MORE INFO ***
I have tried removing from the popup and it works this way. Not what I wanted but It does work this way. Why would it not work in a popup?
I've built a nested comment system and it works fine, but I have a problem.
when I want to show the comments, it runs too many queries. for example if I have 10 comments and two replies each, laravel debugger shows 40+ queries, and I want to reduce them, here is my code :
Query
$comments = $post->mentions()->with(['author', 'reply'])->get();
Relationship in Post.php Model
public function mentions()
{
return $this->hasMany(Comment::class, 'post_id')->where('approved',1)->where('parent_id',0);
}
Comments Relationships
public function author()
{
return $this->belongsTo(User::class, 'author_id')->select('id', 'name', 'avatar', 'role');
}
public function reply()
{
return $this->hasMany(Comment::class, 'parent_id')->where('approved', 1);
}
Blade File
#foreach ($comments as $comment)
<div x-data="{reply:false}" class="break-words bg-white border-2 rounded-lg p-4 my-5" id="answer-{1}">
<div wire:ignore class="flex justify-between items-center">
<div class="flex items-center">
<img class="rounded-full w-20 border-4 #if ($comment->author->role == 'administrator') border-blue-500 #else border-gray-500 #endif " src="{{ $comment->author->avatar }}"
alt="{{ $comment->author->name }}">
<div>
<div class="flex pr-3">
<a href="/#username"
class="font-bold text-lg text-gray-800 hover:text-gray-900">{{ $comment->author->name }}</a>
#if ($comment->author->role == 'administrator')
<img class="w-5 mr-1" src="/img/verified.svg" alt="" title="admin">
#endif
</div>
<p class="font-light cursor-default text-gray-700 pt-1 pr-3">
{{ $comment->created_at->diffForHumans() }}</p>
</div>
</div>
<svg #click="reply = true" xmlns="http://www.w3.org/2000/svg" class="h-6 cursor-pointer hover:text-rose-600"
fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6" />
</svg>
</div>
<div class="comment_body leading-8 pt-3 text-gray-800 cursor-default">
<div wire:ignore>
{!! nl2br($comment->body) !!}
</div>
<div x-cloak x-show="reply">
<form class="py-3" wire:submit.prevent="SubmitComment({{ $comment->id }})">
<textarea wire:model.defer="commentBody"
class="w-full focus:ring-0 bg-zinc-200 border shadow focus:bg-zinc-100 mt-3 p-4 rounded-lg"
id="editor" rows="6" placeholder=""></textarea>
#error('commentBody') <p class="text-red-600 mt-1 text-sm">{{ $message }}</p>
#enderror
<div class="flex mt-3">
<div #click="reply = false"
class="bg-red-600 rounded-lg ml-3 text-white px-3 py-2 cursor-pointer">
Cancel
</div>
<button wire:loading.remove wire:target="SubmitComment" type="submit"
class="inline-block bg-gray-800 hover:bg-gray-900 transition duration-300 px-3 py-2 text-white rounded-md">
Send
</button>
<button wire:loading="" wire:target="SubmitComment" type="button"
class="flex bg-gray-800 hover:bg-gray-900 transition duration-300 px-3 py-2 text-white rounded-md"
disabled>
<span class="flex justify-center">
<svg class="animate-spin w-6 h-6" xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</path>
</svg>
</span>
</button>
</div>
</form>
</div>
<div class="my-3">
#include('partials.comment',['comments'=>$comment->reply])
</div>
</div>
</div>
#endforeach
You can use dot seperator to get the nested relationship
$comments = $post->with(['mentions.author','mentions.reply'])
->first()
->mentions;
Hello i'm using inani larapoll it's works great but in admin panel i can't see results of voting i can see only question, how many answers it have and how many vote was added i want to create custom page in admin where will be results of current vote like it is on WEB
like this
question - > why its don't working
answer1 -> don't know <- this option has 10 votes
answer2 -> because i'm doing something wrong <- this option has 100 votes
i added route
Route::get('/results', ['uses' => 'PollManagerController#results', 'as' => 'poll.results']);
pollmanager controller
public function results(Poll $poll)
{
$total = $poll->votes->count();
$results = $poll->results()->grab();
$options = collect($results)->map(function ($result) use ($total){
return (object) [
'votes' => $result['votes'],
'percent' => $total === 0 ? 0 : ($result['votes'] / $total) * 100,
'name' => $result['option']->name
];
});
$question = $poll->question;
echo view(config('larapoll_config.results') ? config('larapoll_config.results') : 'larapoll::dashboard.results', compact('options', 'question'));
}
and i copied results blade to my new blade
#if(Session::has('errors'))
<div class="alert alert-danger">
{{ session('errors') }}
</div>
#endif
#if(Session::has('success'))
<div class="alert alert-success">
{{ session('success') }}
</div>
#endif
<div class="w-80 m-auto">
<div class="font-size-14 font-medium-caps text-blue-100">{{ $question }}</div>
#foreach($options as $option)
<div class="mt-20px">
<div class="font-size-14 font-size-xs-12 text-blue-100">{{ $option->name }}</div>
<div class="w-100 d-flex justify-content-between pb-5px">
<div class="w-100 d-flex align-items-center">
<div class="w-100 bg-lighter-gray h-4px position-relative">
<div class="position-absolute top-0 bg-yellow h-4px" style='width: {{ $option->percent }}%'> </div>
</div>
</div>
<div class="font-size-14 font-size-xs-12 text-blue-100 pl-10px">{{ $option->percent }}%</div>
</div>
</div>
#endforeach
<div class="d-flex justify-content-between mt-auto pt-30px align-items-center">
<div class="d-flex">
<span class="fas fa-calendar text-light-gray pr-5px"></span>
<p class="mr-20px font-medium font-size-12 text-light-gray"></p>
</div>
<div class="d-flex align-items-center text-light-black flex-end font-base font-size-14 font-size-xs-12"></div>
</div>
</div>
but's its showing nothing... empty
I had this method working before with mysql database but as i have switched my environment to postgresql I got this error.
Facade\Ignition\Exceptions\ViewException
SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
(SQL: select "teachers".*, "student_likes"."student_id" as "pivot_student_id",
"student_likes"."liked_teacher_id" as "pivot_liked_teacher_id"
from "teachers" inner join "student_likes" on "teachers"."id" = "student_likes"."liked_teacher_id"
where "student_likes"."student_id" = 1 and "liked_teacher_id" in (1))
(View: /home/leno/sites/schooly/resources/views/student/likes/index.blade.php)
basically I am trying to perform a match system if both users have liked each other and only display the users if they are a match.
public function matchedTeachers()
{
return $this->likedTeachers()->whereIn('liked_teacher_id', $this->likedStudents->keyBy('liked_teacher_id'));
}
public function likedTeachers()
{
return $this->belongsToMany(Teacher::class, 'student_likes', 'student_id', 'liked_teacher_id');
}
public function likedStudents()
{
return $this->belongsToMany(Student::class, 'teacher_likes', 'teacher_id', 'liked_student_id');
}
#foreach (current_student()->matchedTeachers as $teacher)
<div class="flex flex-col border hover:shadow-lg border-darkindigo-100 rounded-lg">
<div class="flex-1 px-3">
<img src="{{ $teacher->avatar }}" class="block lg:w-20 lg:h-20 rounded-full shadow-xl mx-auto -mt-0 h-20 w-20 bg-cover bg-center object-cover mb-4 mt-4">
<img src="{{ $teacher->teacher_avatar }}" class="block lg:w-10 lg:h-10 rounded-full border-2 border-teal-400 shadow-xl mx-auto -mt-12 ml-32 h-20 w-20 bg-cover bg-center object-cover mb-4 border:z-10">
<div class="text-sm lg:text-lg font-lato font-bold text-gray-800 capitalize text-center leading-8">{{ $teacher->name }}</div>
<div class="text-sm lg:text-sm font-lato font-bold text-gray-700 capitalize text-center">{{ $teacher->language }}</div>
</div>
</div>
#endforeach
I am building a webapp, but I am having some issues and frankly, I'm confused a bit in terms of how things are functioning. I am still learning as I go, making good progress but sometimes I reach a sticking point this one being one.
This first portion is solved thanks to #kerbholz.
I have the main nav-bar with links setup eg. home, create,
share. When I click my "homepage" it brings me to the sign up/login
view. I don't want that to occur but I rather the logged out user or
visitor see the regular homepage with options to register or click the
login button to arrive at the login screen.
Need help for the below roadblock.
Secondly, when I create a test user it passes the data to the database, but the test user is not actually logged-in prompting the sign up/login view whenever I visit any page. How can I actually ensure the registered user data is accepted as logged-in?
I hope my questions make sense and any help would be greatly appreciated. Code is below, let me know if anything else is missing.
REPO https://github.com/PT-83/FamiJam
Auth Login page
#extends('layouts.app')
#section('content')
<? // Hero Section ?>
<div x-data="{ open: false }" class="relative bg-white overflow-hidden">
<div class="max-w-screen-xl mx-auto ">
<div class="relative z-10 pb-8 bg-white sm:pb-16 md:pb-20 lg:max-w-2xl lg:w-full lg:pb-28 xl:pb-32">
<div class="pt-6 px-4 sm:px-6 lg:px-8">
</div>
<div x-show="open" x-transition:enter="duration-150 ease-out" x-transition:enter-start="opacity-0 scale-95" x-transition:enter-end="opacity-100 scale-100" x-transition:leave="duration-100 ease-in" x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 scale-95" class="absolute top-0 inset-x-0 p-2 transition transform origin-top-right md:hidden">
<div class="rounded-lg shadow-md">
<div class="rounded-lg bg-white shadow-xs overflow-hidden">
<div class="px-5 pt-4 flex items-center justify-between">
<div>
<img class="h-8 w-auto" src="/img/logos/workflow-mark-on-white.svg" alt="logo" />
</div>
<div class="-mr-2">
<button #click="open = false" type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
</div>
</div>
<div class="mt-10 mx-auto max-w-screen-xl px-4 sm:mt-12 sm:px-6 md:mt-16 lg:mt-20 lg:px-8 xl:mt-28">
<div class="sm:text-center lg:text-left">
<h2 class="text-4xl tracking-tight leading-10 font-extrabold text-gray-900 sm:text-5xl sm:leading-none md:text-6xl">
Remember Your Family
<br class="xl:hidden" />
<span class="text-indigo-600">Culture & Traditions</span>
</h2>
<p class="mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:max-w-xl sm:mx-auto md:mt-5 md:text-xl lg:mx-0">
Family is important, and so are the stories, homemade recepies, remedies and quality time. Now, there's a simply way to store this information and recall all these special moments.
</p>
<p class="mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:max-w-xl sm:mx-auto md:mt-5 md:text-xl lg:mx-0">Famijam is hard at work tyring to complete this application. As progress is being made Famijam is just not ready yet. However, once ready will be sending out beta test oppourtinies to the very first users who registerd. Famijam wants to ensure we are running correctly ensuring stability first and foremost. Thank you!</p>
<div class="mt-5 sm:mt-8 sm:flex sm:justify-center lg:justify-start">
<div class="rounded-md shadow">
<a href="/register" class="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out md:py-4 md:text-lg md:px-10">
Sign up for updates
</a>
</div>
<div class="mt-3 sm:mt-0 sm:ml-3 invisible ">
<a href="#" class="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-indigo-700 bg-indigo-100 hover:text-indigo-600 hover:bg-indigo-50 focus:outline-none focus:shadow-outline focus:border-indigo-300 transition duration-150 ease-in-out md:py-4 md:text-lg md:px-10">
Live demo
</a>
</div>
</div>
</div>
</div>
<svg class="hidden lg:block absolute right-0 inset-y-0 h-full w-48 text-white transform translate-x-1/2" fill="currentColor" viewBox="0 0 100 100" preserveAspectRatio="none">
<polygon points="50,0 100,0 50,100 0,100" />
</svg>
</div>
</div>
<div class="lg:absolute lg:inset-y-0 lg:right-0 lg:w-1/2">
<img class="h-56 w-full object-cover sm:h-72 md:h-97 lg:w-full lg:h-full" src="/images/fun.svg" alt="Photograp" />
</div>
</div>
<? // End of Hero Section ?>
<? // Features Section ?>
<div class="py-12 bg-white">
<div class="max-w-screen-xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="lg:text-center">
<p class="pt-6 text-base leading-6 text-indigo-600 font-semibold tracking-wide uppercase">Traditions</p>
<h3 class="mt-2 text-3xl leading-8 font-extrabold tracking-tight text-gray-900 sm:text-4xl sm:leading-10">
Share, Learn, Discuss
</h3>
<p class="mt-4 max-w-2xl text-xl leading-7 text-gray-500 lg:mx-auto">
Now more than ever, a place to document family traditions so they will be remembered!
</p>
</div>
<div class="mt-10">
<ul class="md:grid md:grid-cols-2 md:col-gap-8 md:row-gap-10">
<li>
<div class="flex">
<div class="flex-shrink-0">
<div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"/>
</svg>
</div>
</div>
<div class="ml-4">
<h5 class="text-lg leading-6 font-medium text-gray-900">Homemade Section</h5>
<p class="mt-2 text-base leading-6 text-gray-500">
Families often make homemade things, this is a great bonding exercise and also a great place to store recipes, how to's, so we can remember and share with each other.
</p>
</div>
</div>
</li>
<li class="mt-10 md:mt-0">
<div class="flex">
<div class="flex-shrink-0">
<div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 6l3 1m0 0l-3 9a5.002 5.002 0 006.001 0M6 7l3 9M6 7l6-2m6 2l3-1m-3 1l-3 9a5.002 5.002 0 006.001 0M18 7l3 9m-3-9l-6-2m0-2v2m0 16V5m0 16H9m3 0h3"/>
</svg>
</div>
</div>
<div class="ml-4">
<h5 class="text-lg leading-6 font-medium text-gray-900">Travel Section</h5>
<p class="mt-2 text-base leading-6 text-gray-500">
Did you travel to visit family, or travel for leisure? If so, did you discover any unique restaurants, try new foods, or unique scenery? If so, share these findings in our travel section.
</p>
</div>
</div>
</li>
<li class="mt-10 md:mt-0">
<div class="flex">
<div class="flex-shrink-0">
<div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
</svg>
</div>
</div>
<div class="ml-4">
<h5 class="text-lg leading-6 font-medium text-gray-900">Family Tree</h5>
<p class="mt-2 text-base leading-6 text-gray-500">
Upload photographs of family members with a brief description or story to share with other friends or family.
</p>
</div>
</div>
</li>
<li class="mt-10 md:mt-0">
<div class="flex">
<div class="flex-shrink-0">
<div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"/>
</svg>
</div>
</div>
<div class="ml-4">
<h5 class="text-lg leading-6 font-medium text-gray-900">Story Time</h5>
<p class="mt-2 text-base leading-6 text-gray-500">
Remember that special moment or story you experienced or were told. Jokes included.
</p>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
<? // End of Feature Section ---?>
<? // Beginning of CTA ------?>
<div class="bg-white mb-20">
<div class="max-w-screen-xl mx-auto py-12 px-4 sm:px-6 lg:py-16 lg:px-8 lg:flex lg:items-center lg:justify-around">
<h2 class="text-3xl leading-9 font-extrabold tracking-tight text-gray-900 sm:text-4xl sm:leading-10">
Ready to Join?
<br />
<span class="text-indigo-600">Start sharing, learning, discussing today.</span>
</h2>
<div class="mt-8 flex lg:flex-shrink-0 lg:mt-0">
<div class="inline-flex rounded-md shadow">
<a href="/register" class="inline-flex items-center justify-center px-10 py-4 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">
Get started
</a>
</div>
<div class="ml-3 inline-flex rounded-md shadow invisible">
<a href="#" class="inline-flex items-center justify-center px-5 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-indigo-600 bg-white hover:text-indigo-500 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">
Learn more
</a>
</div>
</div>
</div>
</div>
#endsection
#section('footer')
#endsection
LoginController
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* #var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* #return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}
Web.php
<?php
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('home');
});
Auth::routes();
Route::get('/home', 'HomeController#index')->name('home');
Route::get('/about', 'HomeController#about')->name('about');
Route::get('/contact', 'HomeController#contact')->name('contact');
Route::post('/register/create', 'Auth\RegisterController#create')->name('register');
Route::get('/post/index', 'PostController#index');
Route::get('/post/create', 'PostController#create');
Route::get('/post/{post}', 'PostController#show');
Route::post('/post', 'PostController#store');
After saving the $user you just registered, use Auth::loginUsingId($user->id); Then redirect to the view or route you want to.
Because all your routes use the same Controller#Action: /share',
'HomeController#index should be /share', 'HomeController#share etc.
(And return view ('/share'); should be return view ('share'); etc) –
kerbholz
The second part regarding the user, laravel takes care of this out of the box. My problem is because I altered the submission form it affected this feature. I will have to play with the form to enable this function to work again. Technically the second portion of the original question is still open, but not necessary to leave this post still unanswered. Thanks to all that helped.