dipcb05

dipcb05

Member Since 6 Months Ago

Experience Points
1,490
Total
Experience

3,510 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
1,490 XP
Oct
01
3 weeks ago
Activity icon

Started a new Conversation How To Change Datetime Dynamically

i have the location of user, (by IP).

i want to save the localization(datetime, map and other local things) for that individual user based on his location. if he change the location, dynamically my site will provide the local things.

but when i store his information, i made three field, from where he post, his local time , and third one is my local time.

for a example, you posting from france but u r USA citizen.

in database, i want to store like this->

user_current_location: france
post_timestamp: france_local_time
timestamp: my_local_time

when he will back to USA, the location and time will change to usa time.

how i can change it?

for that process, i will ask the location access from user. if he give, then i can do. else, i will show my default local time.

Sep
28
4 weeks ago
Activity icon

Started a new Conversation Can't Fetch File From Public Folder

I want to try fetch from link, which stored in database. but i can't convert it to file format. How i saved it ->

   $resources = $request->file('res');
            if($resources) {
                    $path = 'upload/post/' . $p->id . '/edit/' . $review->id . '/review_resources';
                    $resources = $resources->store($path, 'public');
            }

How i am trying to fetch ->

 
   if($all[0]->res)
            {
                    $contents = "/storage/" . $all[0]->res;
                    $path = 'upload/post/' . $p->id . '/review/' . $r->id . '/review_resources';
                    $r->res = $contents->store($path, 'public');
                    
            }

Actually i wanna move it one folder to another.

and another files i wanna delete and trying to make new.

how i saved it ->

 if(Storage::disk('public')->put($content['docs_link'], $content['docs']))
                        $rev_file->summary_doc = $content['docs_link'];

how i am trying to delete it , fetched link by db query->

  dd( Storage::delete($rev_file[0]->summary_doc);

dd function gives me 'false'.

where is the problem?

Sep
27
1 month ago
Activity icon

Started a new Conversation Your Requirements Could Not Be Resolved To An Installable Set Of Packages.

i want to install laravel markdown package using composer install .


those error giving. what i can do?

  Problem 1
    - Installation request for andreasindal/laravel-markdown 3.0.1 -> satisfiable by andreasindal/laravel-markdown[3.0.1].
    - Conclusion: remove laravel/framework v7.28.3
    - Conclusion: don't install laravel/framework v7.28.3
    - andreasindal/laravel-markdown 3.0.1 requires illuminate/support ^5.5|^5.6|^5.7 -> satisfiable by illuminate/support[5.5.x-dev, 5.6.x-dev, 5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, 5.8.x-dev, v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28, v5.5.33, v5.5.34, v5.5.35, v5.5.36, v5.5.37, v5.5.39, v5.5.40, v5.5.41, v5.5.43, v5.5.44, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9].
    - don't install illuminate/support 5.5.x-dev|don't install laravel/framework v7.28.3
    - don't install illuminate/support 5.6.x-dev|don't install laravel/framework v7.28.3
    - don't install illuminate/support 5.7.17|don't install laravel/framework v7.28.3
    - don't install illuminate/support 5.7.18|don't install laravel/framework v7.28.3
    - don't install illuminate/support 5.7.19|don't install laravel/framework v7.28.3
    - don't install illuminate/support 5.7.x-dev|don't install laravel/framework v7.28.3
    - don't install illuminate/support 5.8.x-dev|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.0|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.16|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.17|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.2|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.28|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.33|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.34|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.35|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.36|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.37|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.39|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.40|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.41|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.43|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.5.44|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.0|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.1|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.10|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.11|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.12|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.13|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.14|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.15|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.16|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.17|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.19|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.2|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.20|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.21|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.22|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.23|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.24|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.25|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.26|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.27|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.28|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.29|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.3|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.30|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.31|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.32|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.33|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.34|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.35|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.36|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.37|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.38|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.39|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.4|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.5|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.6|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.7|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.8|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.6.9|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.0|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.1|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.10|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.11|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.15|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.2|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.20|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.21|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.22|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.23|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.26|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.27|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.28|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.3|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.4|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.5|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.6|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.7|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.8|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.7.9|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.0|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.11|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.12|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.14|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.15|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.17|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.18|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.19|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.2|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.20|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.22|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.24|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.27|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.28|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.29|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.3|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.30|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.31|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.32|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.33|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.34|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.35|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.36|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.4|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.8|don't install laravel/framework v7.28.3
    - don't install illuminate/support v5.8.9|don't install laravel/framework v7.28.3
    - Installation request for laravel/framework (locked at v7.28.3, required as ^7.0) -> satisfiable by laravel/framework[v7.28.3].

i want to use markdown in blade.

Activity icon

Replied to Doesn't Exist Query

thanks. solved

Activity icon

Started a new Conversation Doesn't Exist Query

Hello, I have a problem with a query.

in posts table, i have posts.id, then, in reviews table, i have posts_id(foreign key -> posts.id), reviews.id. i want to query those posts_id which doesn't exist in reviews table(post_id).

i am trying like ->

$r = DB::table('reviews')
            ->select(DB::raw('count(id) as rev_count, posts_id'))
            ->groupBy('posts_id')
            ->get();
        foreach ($r as $rr)
        {
            $p = DB::table('posts')
                ->select('id')
                ->where('id', '!=', $rr->posts_id)
                ->get();
        }

seems, i have successfully extracted the correct value. but with too much complexity, maybe buggy. if any there direct query to extract it?

the tables setup->

reviews:

Schema::create('reviews', function (Blueprint $table)
        {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('posts_id');
            $table->unsignedBigInteger('users_id');
            $table->foreign('posts_id')
                  ->references('id')
                  ->on('posts');
....................

posts:

Schema::create('posts', function (Blueprint $table) {
            $table->id();
        ...................

TIA

Sep
25
1 month ago
Activity icon

Started a new Conversation How To Get The Session Data Of Each User.

i want to arrange some feature depends on user's session data. like. in message module, who is online now.

and i need to get information, user's total activity time in my site. so i need to get their session data.

user->id, user->ip, user->in_time, user->out_time, user->activity_time how to get it?

Sep
20
1 month ago
Activity icon

Started a new Conversation Property Or Method "commentBox" Is Not Defined On The Instance But Referenced During Render. Make Sure That This Property Is Reactive

I want to make a live comment box.

here is my script

 @section('scripts')
            <script>
                const app1 = new Vue({
                    el: '#app1',
                    data: {
                        commentBox: '',
                        comments: {},
                        review: {!! $review->toJson() !!},
                    },

                    methods: {
                        getComments() {
                            console.log(this.commentBox)
                            axios.get('/reviews/'+ this.review.id + '/' + '/comments')
                                .then((response) => {
                                    this.comments = response.data
                                })
                                .catch(function (error) {
                                        console.log(error);
                                    }
                                );
                        },
                        mounted() {
                            this.getComments();
                        },
                        postComment() {
                            console.log('hello world!');
                            axios.post('/reviews/'+ this.review.id+ '/comment', {
                                body: this.commentBox
                            })
                                .then((response) => {
                                    this.comments.unshift(response.data);
                                    this.commentBox = '';
                                })
                                .catch((error) => {
                                    console.log(error);

                                })
                        }
                    }
                })
            </script>
@endsection

route

Route::get('/reviews/{reviews}/comments', '[email protected]');
 Route::post('/reviews/{reviews}/comment', '[email protected]');

Controller

   public function index(posts $posts, Review $review)
    {
        return response()->json($review->comments()->with('user')->latest()->get());
    }

    public function store($review, Request $request)
    {
        $comment = $review->comments()->create([
            'comment' => $request->body,
            'users_id' => Auth::id(),
            'reviews_id' => $review->id,
            'posts_id' => $review->posts_id
        ]);

        $comment = comments::where('id', $comment->id)->with('user')->first();
        return $comment->toJson();

    }

blade


                                <h3>Comments:</h3>
                                <div id = "app1" style="margin-bottom:50px;">
                                    <label>
                                        <textarea class="form-control"
                                                  rows="3"
                                                  name="body"
                                                  placeholder="Leave a comment"
                                                  v-model="commentBox"></textarea>
                                    </label>
                                    <button class="btn btn-success"
                                            style="margin-top:10px"
                                            @click.prevent="postComment">Save Comment</button>
                                </div>

(just checking if the backend works, and post to database, then i will fetch comment in blade)

but it didn't works, and below error showing in the console,

app.js:44521 [Vue warn]: Property or method "commentBox" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

app.js:44521 [Vue warn]: Property or method "commentBox" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
app.js:57363 GET http://localhost:8000/messages 404 (Not Found)
app.js:57363 GET http://localhost:8000/messages 404 (Not Found)
app.js:57777 Uncaught (in promise) Error: Request failed with status code 404
    at createError (app.js:57777)
    at settle (app.js:58038)
    at XMLHttpRequest.handleLoad (app.js:57246)
app.js:57777 Uncaught (in promise) Error: Request failed with status code 404
    at createError (app.js:57777)
    at settle (app.js:58038)
    at XMLHttpRequest.handleLoad (app.js:57246)

what i can do now?

Sep
15
1 month ago
Activity icon

Replied to How To Check Who Have Visited My Specific Pages

@pistle actually i want to mail them about any modification of information. that's why i need to know. and i know them, because there is a admin panel who's controlling it, they have a database of them. they have to create account

Activity icon

Replied to How To Check Who Have Visited My Specific Pages

@snapey yes they must be logged in as a user

Activity icon

Started a new Conversation How To Check Who Have Visited My Specific Pages

I want to check those users, who have visited a single page. if i modify anything of that page, i want to mail or notify those users, who has visited my page.

so how i can check this?

Sep
14
1 month ago
Activity icon

Started a new Conversation Phpstorm Not Recognizing My Models In The App Folder

I am using Laravel 7. I use phpstorm, and great fan of it.

I want to store all of my model files in a single folder named Models into app folder. then i changed this line ->

namespace App; -> namespace App/Models.

But phpstorm is giving a error. it doesn't recognize my folder.

 Undefined constant 'Models'

how to fix it?

Sep
10
1 month ago
Activity icon

Started a new Conversation Namespace Name Doesn't Match The Psr-0/psr-4 Project Structure Laravel 8

I want to keep my all model files in a single directory under app folder. recently i have updated the laravel version of my project to laravel 8 from laravel 7 and php version 7.2 to 7.3. i have heared that, Model folder will available in Laravel 8. but still my IDE gives an error. how can i solve it?

i am using phpstorm.

Sep
06
1 month ago
Activity icon

Replied to How To Access Eloquent

thanks

Sep
05
1 month ago
Activity icon

Replied to How To Access Eloquent

@php {{ $use = App\User::find($post->users_id); echo $use->name;}} @endphp

i write a raw php code for it , it works. i want to do it with eloquent for saving time.

Activity icon

Replied to How To Access Eloquent

post has not any name attribute but user has. i want that name.

Activity icon

Started a new Conversation How To Access Eloquent

i want to access models, in blade file.

example:

in user model

public function posts()
    {
    return $this->hasMany(posts::class, 'users_id', 'id');
    }

in posts class

  public function user()
    {
        return $this->belongsTo(User::class, 'users_id', 'id');
    }

now i want to access user class through post class in blade file

@foreach($posts as $post)
<h1> {{ $post->user()->name }} </h1>
@endforeach

but it didn't work

   @php
                                                   {{ $use = App\User::find($post->users_id); echo $use->name;}}
                                                @endphp

i write a raw php code for it , it works. i want to do it with eloquent for saving time. is it there any option?

Jul
11
3 months ago
Activity icon

Started a new Conversation Variable Not Passed

i have passed variable from a method to route, but an error showing, 'undefined variable'.

controller code -

public function index()
    {
        return view('view');
    }
    public function ip(Request $request)
    {
        $ip = $request->get('ip');
        $admin = $request->get('admin');
        $password = $request->get('pass');
        $rtsp_ip = 'rtsp://'.$admin.':'.$password.'@'.$ip.'/live';
        $test ="test";
        return redirect()->route('view', ['ip'=> $rtsp_ip, 't' => $test]);
    }

blade code -

<h2>{{ $t }}</h2>
<a class="button" href="{{ $ip ?? ''  }}">view the stream {{ $ip ?? '' }}with vlc media player</a>

$ip or $t no one have value.

Jul
08
3 months ago
Activity icon

Started a new Conversation Convert RTSP Protocol To HTTP Protocol

i want to serve any IP camera in my website without using any 3rd party software. in a RTSP link, i can access the ip camera's view. how i can convert it to a HTTP link to embed in laravel website? i have to use maybe webRTC. how?

Jun
19
4 months ago
Activity icon

Started a new Conversation How To Use RTSP API In Laravel App

i want to serve a live video streaming in a Laravel website of CC Camera. User have to provide the IP address of the CC Camera, then streaming start in the site.

for this task , i have to use Real Time Streaming Protocol. i will take the IP and generate a HTML code, how to use it in Laravel?

Jun
02
4 months ago
Activity icon

Started a new Conversation The Requested PHP Extension Ext-http * Is Missing From Your System. Install Or Enable PHP's Http Extension.

because of this two package -

 "ext-pdo": "*",
   "ext-http": "*"

i have to keep them, how can i solve

Activity icon

Started a new Conversation Unknown Column 'DATE(created_at)'

i want to implement this MySQL query by laravel query builders

SELECT COUNT(*) as todays_post
FROM posts
WHERE DATE(created_at) = CURDATE()

what i have written -

 $p2 = DB::table('posts')
                ->select(DB::raw('COUNT(*) as todays_post'))
                ->where('DATE(created_at)' , '=',  'CURDATE()')
                ->get();

the error occurred. how i can solve

May
15
5 months ago
Activity icon

Started a new Conversation Make Another Custom App In Laravel Project

in my laravel app, i want to make another independent system named admin, which no relate with default laravel app. in the admin system, i will write some query for admins, and admin will have some mail from user. according to my faculty instruction, i have to make a custom authentication and authorization using raw php here. so where i have to put the 'admin' folder in my default laravel app? to link with my default app

May
06
5 months ago
Activity icon

Replied to Cannot Declare Class CreatePostsTable, Because The Name Is Already In Use

yes. by search , i found it, but not showed visibly :/

Activity icon

Started a new Conversation Take Input From Bootstrap Modal

i want to take a input from a bootstrap modal in blade file without routing anywhere, and have to pass the value to controller . how to do it?

May
05
5 months ago
Activity icon

Replied to Cannot Declare Class CreatePostsTable, Because The Name Is Already In Use

i have checked them all. no one conflicted. but warning showing also in my phpstorm ide

May
04
5 months ago
Activity icon

Started a new Conversation Cannot Declare Class CreatePostsTable, Because The Name Is Already In Use

when i am going to migrate my database, this error occurred. what should i do? there is no db table or class conflict this. how to solve? where i find the declaration and remove the previous one? recently i have changed my model name post to posts.

May
03
5 months ago
Activity icon

Started a new Conversation Can't Define Perfect Eloquent Relation Function

problem - A user can comment on a post one or more, but one post have to be marked for one user. A post has more than one comment, but one comment have to be marked for one post, and also have to track which user commented.

user model -

 public function posts()
    {
    return $this->hasMany(post::class);
    }
    public function reviews()
    {
        return $this->hasMany(Review::class);
    }

post model -

 public function user()
    {
        return $this->belongsTo(User::class);
    }
    public function reviews()
    {
        return $this->hasMany(Review::class);
    }

Review model -

public function user()
    {
        return $this->belongsTo(User::class);
    }
    public function posts()
    {
        return $this->belongsTo(post::class);
    }

in database, posts table has users_id foreign key, review table has posts_id and users_id table, but connect each other.

i am trying to comment like this -

$user->post->reviews->create( \components );

but there is an error -

Call to undefined method Illuminate\Database\Eloquent\Relations\HasMany::reviews() 

so probably i have to go for many to many relationship, i am trying and failing. now completely confused, which one is suit here.

can anyone help

Activity icon

Replied to Undefined Property: StdClass::$reviews

but what is the technical difference of them? i have checked them using dd() method, they looks almost same object.

Activity icon

Started a new Conversation Undefined Property: StdClass::$reviews

i want to fetch and connect data using eloquent relationship. but i have that error. i mentioned below that specific relation part code.

Review model -

protected $table = 'reviews';

 public function posts()
    {
        return $this->hasOne(post::class);
    }

post model-

protected $table = 'posts';

public function reviews()
    {
        return $this->hasMany(Review::class);
    }

review controller -

 $posts = DB::table('posts')->find($post);
        //dd($posts->reviews);
        if(!$posts->reviews) {
            $reviews = new Review();
            $reviews->posts_id = $posts->id;
            $reviews->save();
        }

the task is user write a review of a post. so i am going to store the foreign key

Activity icon

Replied to Laravel Form Redirect To Same Page After Submit

thanks, after removing validation , it works.

Activity icon

Started a new Conversation Laravel Form Redirect To Same Page After Submit

trying to updating profile using patch. but after submit, it come to same route controller

 public function update()
    {
        $data = request()->validate([
            'name' => 'required',
            'country' => 'required',
            'bdate' => '',
            'job' => 'required',
            'wy' => '',
            'description' => '',
            'website' => 'url',
            'pic' => '',
        ]);
        if(request('pic'));
        {
            $pic = request('pic')->store('upload/pro_pic', 'public');
            $pic2 = ['dd' => $pic];
        }
        dd($data);

    }

view

   <div class="card-body">
                        <form action ="{{ route('profile.update') }}"
                              enctype="multipart/form-data"
                              method="post">
                            @csrf
                            @method('PATCH')
......................

in web.php, this particular route -

Route::patch('/edit', '[email protected]')->name('profile.update');
May
02
5 months ago
Activity icon

Started a new Conversation Call To A Member Function Update() On Null

i want to edit profile with authorization, but didn't work.

policy code

public function update(User $user, Profile $profile)
    {

        return $user->id == $profile->user_id;

    }

controller code

public function update(User $user)
    {

        $data = request()->validate([
            'name' => 'required',
            'country' => 'required',
            'bday' => 'url',
            'job' => 'required',
            'wdate' => '',
            'des' => '',
            'web' => 'url',
            'pic' => '',
        ]);
        if (request('pic'))
        {
            $pic = request('pic')->store('upload/pro_pic', 'public');
            $pic2 = ['image' => $pic];

        }
    
        auth()->user()->profiles->update(array_merge($data, $pic2 ?? []));
        return redirect()->route('profile.show', $user);

model code of Profile

 protected $guarded = [];
    protected $fillable = ['user_id',];
    protected $table = "profiles";
    protected $redirectTo = RouteServiceProvider::HOME;

	public function user()
	{
    return $this->belongsTo(User::class, 'user_id', 'id');
    }

model code of user

protected $fillable = [
        'name', 'username', 'email', 'password','user_id'
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
    /**
     * @var mixed
     */



    protected static function boot()
    {
        parent::boot();

        static::created(function ($user) {
          //  $user->profile()->create(['title' => $user->username,]);
            Mail::to($user->email)->send(new WelcomeMail());
        });
    }


    public function profile()
    {
    return $this->hasOne(Profile::class, 'user_id', 'id');
    }

probably i have to pass the id value as foreign key 'user_id' to the 'profiles' table. because the auth()->user()->profiles always returns me null , because profiles table in the database has nothing. how can i solve it?

Apr
30
5 months ago
Activity icon

Started a new Conversation Script @php Artisan Package:discover --ansi Handling The Post-autoload-dump Event Returned With Error Code 1

I want to host my site in local server, i copied the project folder and paste it to /var/www/html/public_html

then i followed this one to host - https://www.interserver.net/tips/kb/deploy-laravel-project-apache-ubuntu/

i tried to install composer in /var/www/html using super user mode, then i found this error-

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi Could not open input file: artisan Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

i comment out that function, still error occurred.

what i do now

Apr
27
6 months ago
Activity icon

Started a new Conversation Import Algorithm Standard And Others

for my project purpose, user can upload algorithms. i want to give them a privilege that, if they enter special command, his algorithm will enough formatted. example - in laracast, if i use ``` then i can format it like this -

for(i to n)
i++

in stackoverflow, if i use ctrl+k , it will format like this -

for(i to n)
     {    
          for(j to n)
              {
                    j++
              } 
      }

i want to implement them both. but i haven't any clue about it, how to do it