Why you send it in laravel chat?

|
dacrixk 2020-02-27 14:40:53
Can you tell me more please
skys215 2020-02-27 14:50:05
dacrixk 2020-02-27 14:40:53
Can you tell me more please

Following.php
<?php
public function details(){
return $this->hasOne(AppDetail::class);
}
?>

Detail.php
<?php
public function user(){
return $this->hasOne(AppUser::class);
}
?>

SomeController.php
<?php
use AppFollowing;
public function index(){
$followings = Following::with([
‘detail’,
‘detail.user’,
])->get();

dd($follwings);
}
?>

dacrixk 2020-02-27 14:57:40
Thank you..
dacrixk 2020-02-27 14:57:50
But its not working
dacrixk 2020-02-27 14:58:05
i have followers , user and user_details table
skys215 2020-02-27 15:07:33
have you set relationships?
dacrixk 2020-02-27 15:08:35
laravel_discuss-28180.jpg
Users table
dacrixk 2020-02-27 15:08:53
laravel_discuss-28181.jpg

skys215 2020-02-27 15:10:15
Try from the basic first:
$user = User::with([‘followers’,’follwings’])->find(1);
dd($user);
dacrixk 2020-02-27 15:16:49
laravel_discuss-28184.jpg
This is response I’m getting
skys215 2020-02-27 15:24:30
and what’s the problem
dacrixk 2020-02-27 15:26:23
skys215 2020-02-27 15:24:30
and what’s the problem

I am getting data from user table but I also wan data from user_details table

dacrixk 2020-02-27 15:26:37
user with user_details like this
dacrixk 2020-02-27 15:27:21
user contains id,name
user_details contain address,city

I want all data in follow/following response

skys215 2020-02-27 15:27:49
How are you getting now
dacrixk 2020-02-27 15:28:40
skys215 2020-02-27 15:27:49
How are you getting now

I’m getting data from user table only not from user_details table

dacrixk 2020-02-27 15:30:00
I want user with user_details
skys215 2020-02-27 15:31:05
I mean the code
cosmonte 2020-02-27 15:58:57
How to always save and fetch data based on logged user?
cosmonte 2020-02-27 16:00:09
is this right way of doing that
cosmonte 2020-02-27 16:00:14
example here im fetching categories
cosmonte 2020-02-27 16:00:15
@foreach($categories as $category)
@if($category->user_id == auth()->user()->id)
<tr>
<td>

{{ $category->name}}
</td>
<td>
{{ $category->posts->count() }}
</td>
<td>
<a href=”{{ route(‘categories.edit’, $category->id) }}” class=”btn btn-info btn-sm”>Edit</a>
</td>
<td>
<form action=”{{ route(‘categories.destroy’, $category->id)}}” method=”POST”>
@csrf
@method(‘DELETE’)
<button onclick=”return confirm(‘Are you sure you want to delete {{ $category->name }} ?’)” class=”btn btn-danger btn-sm”>Delete</button>
</form>
</td>

</tr>
@endif

@endforeach

skys215 2020-02-27 16:02:25
you can use Request authorize() to block requests of viewing
skys215 2020-02-27 16:03:17
for some element on the page, you can write a helper to check permission, I assume that there is a package to do that
maybe spartie/laravel-permission? I’m not sure
cosmonte 2020-02-27 16:57:16
All controllers should fetch table data based on user_id
cosmonte 2020-02-27 16:57:32
Should I do it on controllers or on models?
skys215 2020-02-27 16:57:41
You can add a scope
cosmonte 2020-02-27 17:02:37
Can you please send me a link reference
skys215 2020-02-27 17:30:57
cosmonte 2020-02-27 17:02:37
Can you please send me a link reference

https://laravel.com/docs/6.x/eloquent#query-scopes

Andersonbsp 2020-02-27 18:20:13
Hello, can you tell me if there is any alternative for connecting unixODBC with laravel 6
Abrar 2020-02-27 19:17:59
Hello, i want to make a notification .. i have a list of students and i want the user to click on specific student and press the button of send an email.. after that i want a notification email to be send to that student .. Anyone knows how to do that?
skys215 2020-02-27 19:23:37
queue
gerasart 2020-02-27 22:53:11
Abrar 2020-02-27 19:17:59
Hello, i want to make a notification .. i have a list of students and i want the user to click on specific student and press the button of send an email.. after that i want a notification email to be send to that student .. Anyone knows how to do that?

i know but not free

2020-02-27 23:09:09
https://youtu.be/EsAOHsNPn3M
gerasart 2020-02-27 23:21:42
2020-02-27 23:09:09
https://youtu.be/EsAOHsNPn3M

why you send it in laravel chat ?

2020-02-27 23:56:52
gerasart 2020-02-27 23:21:42
why you send it in laravel chat ?

Sorry by mistake

cosmonte 2020-02-28 02:01:13
laravel_discuss-28240.jpg

cosmonte 2020-02-28 02:01:26
laravel_discuss-28241.jpg

rebory 2020-02-28 09:46:14
cosmonte 2020-02-28 02:01:26

return view(‘todo.index’ , compact(‘activeCustomers’));

rebory 2020-02-28 09:47:25
in todo index blade @foreach($activeCustomers as $customer) <p> {{ $customer->name }} </p> @endforeach
harmlez_prinz 2020-02-28 11:06:43
Hello, Good morning, Please am trying, load another select option dependent on another.
e.g when the user selects department, the designations undder that department should be loaded automatically
harmlez_prinz 2020-02-28 11:08:05
laravel_discuss-28249.jpg
Here is my Ajax Query for loading, but not working
harmlez_prinz 2020-02-28 11:08:57
laravel_discuss-28250.jpg
Here is my controller code
harmlez_prinz 2020-02-28 11:09:55
laravel_discuss-28251.jpg
Here is my html
Mani 2020-02-28 12:51:44
Want to switch b/w multi dbs in one app including http and console requests.
Mani 2020-02-28 12:52:38
Tried in middleware and provider but didnt work
Mani 2020-02-28 12:52:46
Any help will be really appreciated
Mani 2020-02-28 12:54:22
Dbs will be dynamic
Mani 2020-02-28 12:55:51
laravel_discuss-28260.jpg

harmlez_prinz 2020-02-28 15:31:08
Good day, Please am trying save from inputs i generated dynamically using JQuery.

public function saveDepartment(Request $request)
{
$this->validate($request,[
‘designation_name’ => ‘required’,
‘department_name’ => ‘required’,
]);
$department_name = new Department();
$department_name->department_name = $request->input(‘department_name’);
$department_name->save();
$designation_name = new Designation();
$designation_name->designation_name = $request->input(‘designation_name’);
$designation_name->save();

}

NOTE: My designation input is generated dynamically. Please how do i go about this ?

|