nnnayeem

nnnayeem

Member Since 1 Year Ago

Experience Points 1,880
Experience Level 1

3,120 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 1
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

26 Feb
3 weeks ago

nnnayeem left a reply on Php Artisan Not Working. Tried Almost Everything.

@snapey, I ran php -v and gave me the php version. I also deleted the lof file and no new log was added later to the log file.

@talinon I did what you asked. It still did not work. Showing timeout error.

 [Symfony\Component\Process\Exception\ProcessTimedOutException]
  The process ""D:\xampp\php\php.exe" -d allow_url_fopen="1" -d disable_functions="" -d memory_limit="1536M" artisan package:discover" exceeded the timeout of 300 se
  conds.
25 Feb
3 weeks ago

nnnayeem left a reply on Php Artisan Not Working. Tried Almost Everything.

I ran php artisan list too. But still is not working. It freezes and does no show any errors. What I don't understand is why suddenly happened this. My project was running perfectly. My other project is running too. No artisan error. @talinon could you give any direction?

nnnayeem left a reply on Php Artisan Not Working. Tried Almost Everything.

@snapey thank you for your reply. My project is running perfectly except no artisan command is working. And I have seen in the laravel log file but there is not error in current date.

nnnayeem started a new conversation Php Artisan Not Working. Tried Almost Everything.

Hello everyone. I am facing an unexpected problem. My project was working fine but suddenly artisan command stopped working. Then I googled and tried the following:

    composer dumpautoload

    composer update 

    php artisan optimize

But nothing worked. If I run only php artisan it freezes and does not show any error. I noticed whenever I tried to update composer the error occured when

    @php artisan package:discover

start compiling and it freezes. I guessed mybe custom command caused this error so I removed those command. After that If I run

php artisan:list
Could not open input file: artisan:list

I really stuck here. Need help. I am using laravel 5.5.

nnnayeem left a reply on Getting Null Value Of $event In Hadle Method Of Laravel Event

Sorry my mistake. I have found my problem.My problem is in the event class. In the constructor I did not assign $now to the public property.

    <?php

namespace App\Handlers\Events;

use App\Events\CountProduction; use App\Order; use App\Target; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue;

class CountProductionHandle implements ShouldQueue { public $connection = 'database'; /** * Create the event listener. * * @return void */ public function __construct() { // }

/**
 * Handle the event.
 *
 * @param  CountProduction  $event
 * @return void
 */
public function handle(CountProduction $event)
{
    $type = $event->type;
    $floor = $event->floor;
    $line = $event->line;
    $target = Target::whereDate('day',$event->day)->where('floor_id',$event->floor)->where('line',$event->line);
    $tgt = $target->first();
    if(!empty($tgt)){
        if($type == 'g')
        {
            $target->increment('green');
            $order = $tgt->order;
            $production = $order->production;
            $orderId = $order->id;
            $order_u = Order::find($orderId);
            if(!empty($order_u)){
                $order_u->update(['production'=>$production+1]);
            }
        }
        elseif($type == 'y')
            $target->increment('yellow');
        elseif($type == 'r')
            $target->increment('red');
        $tgt->details()->create(['type'=>$type,'floor_id'=>$floor,'line'=>$line]);
    }

}

}

nnnayeem left a reply on Getting Null Value Of $event In Hadle Method Of Laravel Event

My handle method of laravel handler:

     public function handle(CountHourlyProduction $event)
{

// dd($event); $now = $event->now; $last = $event->lastHour->format('H'); $current = $now->format('H');

    $lastTime = Carbon::createFromTime($last, 0, 0)->format('H:m:s');
    $currentTime = Carbon::createFromTime($current, 0, 0, 'Asia/Dhaka')->format('H:m:s');

    $floors = Floor::with(['targets'=>function($query) use($now){
        $query->whereDate('created_at',$now->format('Y-m-d'));
    }])->get();


    foreach ($floors as $floor){
        $this->processTargets($floor->targets,$current,$lastTime,$currentTime);
    }
}

I am getting null error of:

$now = $event->now;

If I use shouldQueue method. and process fails.

nnnayeem started a new conversation Getting Null Value Of $event In Hadle Method Of Laravel Event

Hello everyone. I am having problem on laravel event.

When I use laravel shouleQueue $event in handle method gives null but works fine if I dont use shouldQueue.

Thanks

24 Feb
3 weeks ago

nnnayeem left a reply on Js Stopt Working Because Of Vue?

Did you add yield('scripts') to your layout file. Check that carefully and also check if only vue is not loading by adding another script tag in the script section.

nnnayeem left a reply on Form Request Get Only Fields With Validation Rules

You can validate checking the steps via checking url. Like:

if(step1URL){
    some validation rule
elseif(step2URL){
    some validation rule
}
16 Feb
1 month ago

nnnayeem left a reply on Laravel Schedule:run Is Not Working On Server(via Cron Jobs)

I solved the issue by specifying the php version in the command line:

* * * * * /usr/local/bin/ea-php71 /home/nemanu/root1/artisan schedule:run >> /dev/null 2>&1
14 Feb
1 month ago

nnnayeem left a reply on Laravel Schedule:run Is Not Working On Server(via Cron Jobs)

After a bit of analysis I have found that every time the cron is running it gives me a error in error log:

[15-Feb-2019 03:51:01 UTC] PHP Parse error:  syntax error, unexpected '?' in /home/nemanu/root1/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 233

I am using php 7.1

nnnayeem left a reply on Laravel Schedule:run Is Not Working On Server(via Cron Jobs)

Yes I have set up the frequency in cpanel. As I am using shared hosting how do I check php executable?

When I run schedule run command from cotroller it works fine. But in cronjobs does not work. I gave the following command to see log file but file is empty:

/usr/local/bin/php /home/nemanu/root1/artisan schedule:run 1>> /home/nemanu/public_html/log_laravel 2>&1

Note:Before changing the hosting I was able to change the root but now I cant. If I do shows no specified file error which I could not resolved. So I had to keep public file in public_html folder and rest of them in /root1. I mentioned it thinking if it is related somehow.

nnnayeem started a new conversation Laravel Schedule:run Is Not Working On Server(via Cron Jobs)

Hello everyone, I am trying to run schedule run command on server via cron job. I used following command

usr/local/bin/php /home/nemanu/root1/artisan schedule:run >> /dev/null 2>&1 

It worked previously but after changing the hosting it is not working.

Note:my public files are in public_html folder and rest of them are in /home/nemanu/root1

Thanks in advance.

20 Oct
5 months ago

nnnayeem left a reply on Laravel Is Trying To Update _method Field

Thank you @thomask for your answer. It solved my problem. I dd the vendor() and vendor method. In vendor() it maybe return hasOne relation querey builder and in vendor it returns the instance of the model.

Thanks again for your time.

19 Oct
5 months ago

nnnayeem left a reply on Laravel Is Trying To Update _method Field

@thomaskim thanks for your reply. Actually I have different kind of user like vendor, customer and so on. So, What I am doing here is saving information as per the type of user by eloquent relation. On my user model I have defined one to one relation with vendor model and saved additional data for vendor.

I am trying to update user data and vendor data as the user is a vendor.

nnnayeem left a reply on Laravel Is Trying To Update _method Field

@borisu, @tykis @munazzil , @Snapey Thanks all of you guys for your cool solution. But what I can't understand why I have to use this technique in this case here. I have been updating other model also but I did not have to do this way. What is the main reason for this problem to be caused?

nnnayeem started a new conversation Laravel Is Trying To Update _method Field

Hello everyone,

One my project I am trying to update some data but getting this error SQLSTATE[42S22]: Column not found: 1054 Unknown column '_method' in 'field list' (SQL: update vendors set _method = PATCH, _token = LTWtWQjXpMd5Pi6xQdn2oS6PuaPovsKLP6Sz7M00, name = a, phone = 2323, fatherName = a, motherName = a, gender = male, birthDate = 2018-10-31, permanentAdd = a, altPhone = 121212, nomineeName = a, nomineePhone = 121212, nomineeRelation = Sister, updated_at = 2018-10-19 06:13:35 where vendors.user_id = 103 and vendors.user_id is not null)

My route:

Route::patch('profile/{id}/update','[email protected]');

My Controller:

public function UpdateProfile(Request $request,$id){ if(Auth::user()->id == $id){ $data = $request->all(); $rules = [ 'name'=>'required|max:100', 'phone'=>'required|max:100', 'fatherName'=>'required|max:100', 'motherName'=>'required|max:100', 'gender'=>'required|max:100', 'birthDate'=>'required|max:100', 'permanentAdd'=>'required|max:100', 'altPhone'=>'required|max:100', 'nomineeName'=>'required|max:100', 'nomineePhone'=>'required|max:100', 'nomineeRelation'=>'required|max:100', ]; $message = [ 'name.required'=>'name re', ]; Validator::make($data,$rules,$message)->validate(); $user = User::findOrFail($id); // array_except($data,'email'); $user->update($data); $user->vendor()->update($data); return redirect('/vendor-profile'); }else{ abort(404); }

}

I have searched solution for this problem onine. The are all telling to except the _method and _token method. Some saying to use $fillable property.

But I have already used $fillable property and also updated model in the above mentioned way. I just cant figure out what is the problem?

28 Sep
5 months ago

nnnayeem left a reply on Laravel Takes Time To Broadcast Event To Pusher

Thanks for your comment @wilk_randall . I made a silly mistake while uploading to server. I did not tell laravel that I am using pusher in env file. After correcting it works perfectly. One thing I want to ask you though. I am not using laravel echo. Is there any problem not using it?

25 Sep
5 months ago

nnnayeem left a reply on Laravel Takes Time To Broadcast Event To Pusher

Thank you Snapery for your answer. Then what could I use other than pusher.

nnnayeem left a reply on What A Appropriate Validation For Value 0 ?

you should add min:0 to the validation rule

nnnayeem left a reply on Laravel Takes Time To Broadcast Event To Pusher

It is also mentionable that sometimes data is being to sent pusher instantly but pusher is not responding to the event,

nnnayeem started a new conversation Laravel Takes Time To Broadcast Event To Pusher

Hello everyone. One of my laravel app, I am broadcasting events using puser. On the local server the event is sent and received perfectly. But after uploading to server laravel sometimes send the event sometime not and pusher takes time to response on the event. But in the localhost it is working perfectly. Instantly sending and receiving the event.

I am using laravel 5.5.

20 Aug
7 months ago

nnnayeem left a reply on Getting Error MethodNotAllowedHttpException

Sorry My mistake I am sending patch to post route. The following change

Route::PATCH('admin/machines/setMachine/{floor_id}','Admin\[email protected]')->name('setMachine');

Solve the problme

nnnayeem started a new conversation Getting Error MethodNotAllowedHttpException

I am trying to update data. I am using laravel Collective as a form builder. whenever I submit the form I face this error. I checked my route if it the method is correctly used. But all seems to okay. I even checked if the laravel collective added _token filed.

I showing my code bellow

    {!! Form::open(['method' => 'PATCH','url' => ['/admin/machines/setMachine', $floor_id],'class' => 'form-horizontal','files' => true]) !!}

                            <div class="form-group {{ $errors->has('machine_category_id') ? 'has-error' : ''}}">
                                {!! Form::label('machine_category_id', 'Select Machine Category', ['class' => 'col-md-4 control-label']) !!}
                                <div class="col-md-6">
                                    {!! Form::select('machine_category_id', [0=>'Select Machine Category']+$machineCats, null, ('' == 'required') ? ['class' => 'form-control', 'required' => 'required'] : ['class' => 'form-control']) !!}
                                    {!! $errors->first('machine_category_id', '<p class="help-block">:message</p>') !!}
                                </div>
                            </div>

                            <div id="machines" style="display: none">
                                <div class="form-group {{ $errors->has('id') ? 'has-error' : ''}}">
                                    {!! Form::label('id', 'Select Machine', ['class' => 'col-md-4 control-label']) !!}
                                    <div class="col-md-6">
                                        {!! Form::select('id', []+$machines, null, ('' == 'required') ? ['class' => 'form-control', 'required' => 'required'] : ['class' => 'form-control','id'=>'machine']) !!}
                                        {!! $errors->first('id', '<p class="help-block">:message</p>') !!}
                                    </div>
                                </div>
                            </div>



                            <div class="form-group">
                                <div class="col-md-offset-4 col-md-4">
                                    {!! Form::submit(isset($submitButtonText) ? $submitButtonText : 'Add Machine', ['class' => 'btn btn-success']) !!}
                                </div>
                            </div>


                    {!! Form::close() !!}

My route

        Route::get('admin/machines/setSwitch/{floor_id}/{switch}','Admin\[email protected]');

Route::post('admin/machines/setMachine/{floor_id}','Admin\[email protected]')->name('setMachine');

29 Jul
7 months ago

nnnayeem left a reply on Trying To Build Rest Api Using Postman

You meant in JSON form

28 Jul
7 months ago

nnnayeem left a reply on Trying To Build Rest Api Using Postman

I am using post. I am not setting header because after getting the result I can see that the postman automatically set the header.

In the raw I wrote like this for html:

<input type="hidden" name="testing" value="v1>

Is it okay or do I have to create a entire form in the raw?

nnnayeem left a reply on Trying To Build Rest Api Using Postman

@Snapey could you give me a answer if you have the solutio of this problem?

nnnayeem started a new conversation Trying To Send Data Using Raw Html Using Postman

Hello everyone. Currently I am working on a project where I am sending data using postman to my laravel app. I want to use laravel raw while the content type is html or plain text and I want to capture the data in laravel controller. So far, I succeeded using json. But I dont want to use json. Everytime I send data It gets me empty array. I also disabled the csrf token for that route. The code is added below:

        //I tried using this but shows empty array
        
        public function getData(Request $request){
                $p = $_POST;
                dd($p);
   
            }




        //I also tried this

            public function getData(Request $request){
                dd($request->all());
   
            }

Everytime gives me empty array. I tried using html raw like following: <input type="hidden" name="testing" value="v1>

15 Jul
8 months ago

nnnayeem left a reply on Laravel Paypal IPN

Could you solve your problem?

13 Jul
8 months ago

nnnayeem started a new conversation Want To Use $_POST['--'] Sending By Ipn To A Http Listener Url That I Registerd

Hello. I am using laravel 5.5. In my app, I am placing order and customer is paying the payment another api. The api sends notification through ipn by a http listener to a specific url that I registered to the ipn setting page in their website. I have to grab the notification by $_POST['--'] because they are sending a post request.

How do I grab the notification. Is it related to laravel event listener? Ho do I use in this case?

Note: I can't grab the post data using $_POST because it shows page expire.

04 Jul
8 months ago

nnnayeem left a reply on Controller Not Found After Uploading To Server

only difference is app folder which is in lower case. But in the namespace it is in uppercase. Other than that all is same.So I changed app to lowercase in controller.

nnnayeem left a reply on Controller Not Found After Uploading To Server

I changed the namespace into the controller still same problem

nnnayeem left a reply on Controller Not Found After Uploading To Server

My directory is:

app/Http/Controllers/Admin

And my namespace is:

namespace App\Http\Controllers\Admin;

Do I have to change it to:

app\Http\Controllers\Admin;

nnnayeem started a new conversation Controller Not Found After Uploading To Server

Hello everyone. I am working on a project which is running fine in the localhost but after uploading to server, I am facing the following problem:

        ReflectionException (-1)
                    Class App\Http\Controllers\Admin\salesController does not exist

But the controller is there. Why showing the error on server but not showing on local environment. My route is:

Route::middleware(['auth','ClearanceMiddleware'])->group(function (){
        Route::prefix('/admin')->group(function(){

                Route::resource('/roles','RoleController');
                Route::resource('/permission','PermissionController');
                Route::resource('/users','AdminUsersController');
                Route::resource('/category','CategoriesController');
                Route::resource('/products','ProductsController');
                Route::resource('/brand','BrandsController');
                Route::resource('/deals','DealsController');
                Route::get('/sales','Admin\[email protected]')->name('SalesHome');
                Route::get('/sales/{id}/show/{print}','Admin\[email protected]')->name('invoice');
                Route::get('/sales/{id}/pdf','Admin\[email protected]');
                Route::get('/report/sales','Admin\[email protected]')->name('SalesReport');

            });

        });

Others are working perfectly fine. I have checked my namespace and is also fine.

        namespace App\Http\Controllers\Admin;

Another thing I have to add that, before uploading to server I ran cache:clear command. But still was showing problem on the first run so I had to manually change the bootstrap cache config by renaming it to old. I added this because I don't know if it is related or not. Because before I was not facing this problem. Running the command was enough. But some reason its not working now. Thought it might be useful to solve the problem.

03 Jul
8 months ago

nnnayeem left a reply on Want To Check If Symlink Exist Or Not

How do I find out the problem?

nnnayeem left a reply on Want To Check If Symlink Exist Or Not

sorry, I forgot to mention I am using laravel 5.5. Is it possible to do that or there is another way to solve this problem.

nnnayeem started a new conversation Want To Check If Symlink Exist Or Not

Hi everyone. I created symbolic link of storage using storage:link command and working perfectly. But after clearing the cache using cache:clear command the link of the storage is getting unlinked(I was also generating new key too).

I want to check on the first time run of the app, after clearing the cache if the link exist or not. If not I want to link the storage again not by command but by automatically so that user does not has to link every time clear the cache.

22 Jun
8 months ago

nnnayeem left a reply on Flash Message Reappearing

No it is not working. Important Note: I am using laravel session in the javascript condition.

nnnayeem left a reply on Flash Message Reappearing

Yes I did. If I use like this when the value becomes false it shows empty string in console but when true it shows 1.

nnnayeem started a new conversation Flash Message Reappearing

I am sending flash message from controller like this: return redirect('admin/goals')->with('created', 'Goal added!'); And I am showing the flash message like this: $(document).ready(function(){ console.log({!! Session::has('deleted') !!}); if({!! Session::has('deleted')?1:0 !!}) { notif({ type: "success", msg: "{{Session('deleted')}}", position: "right", fade: true, multiline: true }); }

            if({!! Session::has('created')?1:0 !!}) {
                notif({
                    type: "success",
                    msg: "{{Session('created')}}",
                    position: "right",
                    fade: true,
                    multiline: true
                });
            }

            if({!! Session::has('updated')?1:0 !!}) {
                notif({
                    type: "success",
                    msg: "{{Session('updated')}}",
                    position: "right",
                    fade: true,
                    multiline: true
                });
            }
        });
    });
</script>

But after generating the flash message on time the message keep appearing whenever I redirect to that url.

21 Jun
9 months ago

nnnayeem started a new conversation Need Help For Chart Implementation

I want to show daily income of two months for comparing between present month and previous month of the same year. I tried using chart.js. While using chart.js I found out that I can't compare two charts because one chart is filled with 30 days while the chart for present month is not. But chart.js line chart wrap to 30 day with the information that is given to its dataset. I need a chart where I can't plot point by point.

nnnayeem left a reply on Get Portion Of The Route

That worked perfectly. Thank you for your help.

nnnayeem left a reply on Get Portion Of The Route

Thanks for your reply. I tried using the first solution. But is not working. It should be working.

    <li class="{{Request::is('admin/deals/*')?'active ':''}}treeview">
                <a href="#">
                    <i class="fa fa-user"></i>
                    <span>Deals</span>
                    <span class="pull-right-container">
                  <i class="fa fa-angle-left pull-right"></i>
                </span>
                </a>
                <ul class="treeview-menu">
                    <li{!! Request::is('admin/deals')?' class="active"':'' !!}><a href="/admin/deals"> 
                     <i class="fa fa-users"></i> Manage Deals</a></li>
                    <li{!! Request::is('admin/deals/create')?' class="active"':'' !!}><a 
                     href="/admin/deals/create"><i class="fa  fa-user-plus"></i> Deals Create</a> 
                   </li>
                </ul>
            </li> 

nnnayeem started a new conversation Get Portion Of The Route

I want to get a portion of laravel route. Suppose my route is: http://bill.local/admin/slider/create I want to get only slider. Basically, I want to validate if the given route is from slider. I am using laravel 5.5.

20 Jun
9 months ago

nnnayeem left a reply on Trying To Add Multiple Model On Polymorphic Relation

It worked perfectly. Could you explain what happened here or share documentation. Thanks a lot.

nnnayeem left a reply on Trying To Add Multiple Model On Polymorphic Relation

on the Product model

    public function deal()
        {
             return $this->morphMany('App\Deal','dealable');
        }

On the Deal Model

        public function dealable()
        {
         return $this->morphTo();
     }