shariff

junior web developer at Bangalore

Member Since 1 Year Ago

bangalore

Experience Points
8,740
Total
Experience

1,260 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
38
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.

  • Community Pillar

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

Level 2
8,740 XP
Feb
21
1 week ago
Activity icon

Replied to Unable To Install Any Package In Laravel After Downloading Latest Xampp

@trin Nothing was working so I upgraded my laravel project to laravel 8 from 7. Based on that I have upgraded all the packages version and run composer update. it was working fine now. Thanks for helping

Activity icon

Replied to Unable To Install Any Package In Laravel After Downloading Latest Xampp

@trin when installing laravel/ui I am getting this error now

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/ui[v3.2.0, ..., 3.x-dev] require illuminate/console ^8.0 -> found illuminate/console[v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
    - Root composer.json requires laravel/ui ^3.2 -> satisfiable by laravel/ui[v3.2.0, 3.x-dev].


Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Activity icon

Replied to Unable To Install Any Package In Laravel After Downloading Latest Xampp

@trin thanks for the answer. I'll work and let u know

Activity icon

Started a new Conversation Unable To Install Any Package In Laravel After Downloading Latest Xampp

Hi

I recently downloaded the latest xampp and shifted all my project to it. After that I cannot able to install any new packages. I am getting errors


Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires php ^7.2.5 but your php version (8.0.2) does not satisfy that requirement.
  Problem 2
    - Root composer.json requires laravel/ui 2.4 -> satisfiable by laravel/ui[v2.4.0].
    - laravel/ui v2.4.0 requires php ^7.2.5 -> your php version (8.0.2) does not satisfy that requirement.

I tried different solution like updating composer.json file. by seeing this https://stackoverflow.com/questions/65454412/root-composer-json-requires-php-7-3-but-your-php-version-8-0-0-does-not-satis

"require": {
    "php": "^7.2.5 || ^8.0",
    .....
},

but not working. I need help in solving this issue

Thank you

Nov
27
3 months ago
Activity icon

Replied to How To Get Records Between 2 Different Dates

@michaloravec Thank you very very much. I was trying this thing from morning thank you once again

Activity icon

Replied to How To Get Records Between 2 Different Dates

@godzilaravel Ya activity_date is a date format. columns are with date data type.

if it is in date format again I should convert to date format using carbon?

Activity icon

Started a new Conversation How To Get Records Between 2 Different Dates

Hi

I need to get a set of records based on some condition. I tried different ways But I am not getting the exact result.

for example I am getting one input called activity_date. This date need to check in table in 2 differernt columns startdate and enddate.

my code

 public function store(Request $request)
    {
	     $activity_date = $request->date;
		 
		 $challenges = Challenge::where('start_date','>=',$activity_date)->where('end_date','<=',$activity_date)->get(); //not working
		 
		 $challenges = Challenge::whereDate('start_date','>=',$activity_date)->whereDate('end_date','<=',$activity_date)->get(); //not working
		 
         dd($challenges);
    }
	

I need to check activity_date to 2 different columns in challenges table. I need records between that dates.

Nov
09
3 months ago
Activity icon

Replied to Unable To Display Raw Html Data In Blade File Using Substr Function

@automica thank you very very much Finally I have done using your solution.

Activity icon

Replied to Unable To Display Raw Html Data In Blade File Using Substr Function

@gitwithravish sorry I need to print the description as it is how a user has been added using text editor. I am using ckeditor for adding description.

Activity icon

Replied to Unable To Display Raw Html Data In Blade File Using Substr Function

@gitwithravish render html from that string. I am using text editor while adding the description. How user add description I need to render as it is

Activity icon

Replied to Unable To Display Raw Html Data In Blade File Using Substr Function

@automica Thanks for replying. I will try this code if I am not able to do this one. We cannot able to do direct in blade?

Activity icon

Replied to Unable To Display Raw Html Data In Blade File Using Substr Function

@gitwithravish

this is {{ $blog->description }} result

<h2 style="margin: 0px 0px 10px; padding: 0px; font-weight: 400; font-family: DauphinPlain; font-size: 24px; line-height: 24px; background-color: #ffffff;">Where does it come from?</h2> <p style="margin: 0px 0px 15px; padding: 0px; text-align: justify; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px; background-color: #ffffff;">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>

{!! substr($blog->description,0,200) !!} result

Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
Activity icon

Started a new Conversation Unable To Display Raw Html Data In Blade File Using Substr Function

I need to get first 100 characters from MySQL database. while displaying I can able to display all the characters using {!! $blog->description !!} code. If I need to display 100 characters it is not working {!! substr($blog->description,0,200) !!}

In the below code I am getting exact data with raw html tags


<p>  {{  substr($blog->description,0,200)  }} </p>

In the below code I am not getting any data only


<p>  {!! substr($blog->description,0,200) !!} </p>

Oct
28
4 months ago
Activity icon

Replied to How To Use If Condition In WhereIn Clause

@michaloravec Thanks for links surely I will go through that thank you so much.

Activity icon

Replied to How To Use If Condition In WhereIn Clause

@sinnbeck Thanks very very much for helping. You are the best. I don't remember how many things I have learned from you.

Activity icon

Replied to How To Use If Condition In WhereIn Clause

@michaloravec Hey thanks for your help the 2nd code is working and I am able to get the exact result . But I don't know how the code is working. But thank you very very much

Activity icon

Replied to How To Use If Condition In WhereIn Clause

@michaloravec I tried your code. I am returning same empty rows

Activity icon

Replied to How To Use If Condition In WhereIn Clause

@sinnbeck

false
array:1 [▼
 0 => array:1 [▼
   "region_name" => "All"
 ]
]

Activity icon

Replied to How To Use If Condition In WhereIn Clause

@sinnbeck I got this query

"select * from `claims` where `brand_id` in (?) and `store_region` in (?) and `claims`.`deleted_at` is null order by `created_at` desc"
Activity icon

Replied to How To Use If Condition In WhereIn Clause

@sinnbeck the problem is I am getting data if regions not have All. If regions contains All I am not getting data based on only brands names it is returning empty rows.

for better understanding

if brands = 'ABC' and region='South' I should get data based on 2 condition brands and region. (this is working fine)

if brands = 'ABC' and region='All' I should get data based on only brands.

Activity icon

Replied to How To Use If Condition In WhereIn Clause

@sinnbeck I am not getting any error. But I am getting empty DATA

Activity icon

Replied to How To Use If Condition In WhereIn Clause

@sinnbeck thanks for helping. But is not working

Activity icon

Replied to How To Use If Condition In WhereIn Clause

@sinnbeck I don't know whether I am doing it correct or not for this code

 $claim = Claim::whereIn('brand_id',$brands)
                ->where(function($query) use($region) {
                    $query->when(!in_array('All',$region->toArray()),function($q){
                        $q->whereIn('store_region',$region);
                    });
                })->latest()->get();

I am getting error {message: "Undefined variable: region", exception: "ErrorException",…}

Activity icon

Replied to How To Use If Condition In WhereIn Clause

@sinnbeck I tried using when keyword I am getting an error


in_array() expects parameter 3 to be bool, object given", exception: "ErrorException"

Activity icon

Started a new Conversation How To Use If Condition In WhereIn Clause

I want to retrieve data based on certain condition. The condition is I need check first it matches the brands names and then I need to check the regions. If region is equal to All then no need to check for regions and it is not then I need to check regions as well.

I have tried some code But it is not working. I need some help in writing a Laravel query.


public function index(Request $request)
{

        $brand_name = Auth::user()->brands()->get(['brand_name']);
        $brands = Brands::whereIn('brand_name',$brand_name)->get(['id']);
        $region = Auth::user()->regions()->get(['region_name']);


      $claim = Claim::whereIn('brand_id',$brands)
                ->where(function($query) use($region) {
                    if(!in_array('All',$region->toArray()))
                    {
                        $query->whereIn('store_region',$region);
                    }
                })->latest()->get();

      dd($claim);


}


I don't know whether we can use if condition inside query or not. I have tried like this but not working

Oct
27
4 months ago
Activity icon

Replied to Dd($request->file) ; Getting Null

@dev_kanok Can you paste your controller code as well?

Oct
23
4 months ago
Activity icon

Replied to Internal Server Error 500 While Calling POST API (Laravel)

@sinnbeck You are right it was from server error. It is a new cpanel so the .env file was hidden. after changing setting configuration it was working fine.

Thank you very very much for guiding me if u were not telling about server error I should have wasting more time in that. Thank you once again.

Activity icon

Replied to Internal Server Error 500 While Calling POST API (Laravel)

@majdiden @jjoek The error is from laravel log and that error was encountered earlier.

Activity icon

Replied to Internal Server Error 500 While Calling POST API (Laravel)

In logs the last error is this.

[2020-10-22 09:45:11] local.ERROR: Invalid route action: []. {"exception":"[object] (UnexpectedValueException(code: 0): Invalid route action: []. at C:\xampp\htdocs\starship\vendor\laravel\framework\src\Illuminate\Routing\RouteAction.php:91)
Activity icon

Replied to Internal Server Error 500 While Calling POST API (Laravel)

@sinnbeck thanks for your response. In logs it is not showing anything if I hit the API.

Activity icon

Started a new Conversation Internal Server Error 500 While Calling POST API (Laravel)

Hi, I have created one POST API for sending mails. When I am calling this API I am getting an error like this

Http failure response for http://starshipllp.com/starship-backend/public/api/sendEmail: 500 Internal Server Error full detail error

error:
message: "Server Error"
__proto__: Object
headers: Ep
lazyInit: ()=> {…}
arguments: (...)
caller: (...)
length: 0
name: ""
__proto__: ƒ ()
[[FunctionLocation]]: main-es2015.6970d90….js:1
[[Scopes]]: Scopes[4]
lazyUpdate: null
normalizedNames: Map(0) {}
__proto__: Object
message: "Http failure response for http://starshipllp.com/starship-backend/public/api/sendEmail: 500 Internal Server Error"
name: "HttpErrorResponse"
ok: false
status: 500
statusText: "Internal Server Error"
url: "http://starshipllp.com/starship-backend/public/api/sendEmail"

my controller

public function sendMail(Request $request)
     {
         $data = $this->validate($request,[
             'name' => 'required',
             'email' => 'required',
             'phone' => 'required',
             'address' => 'required',
             'orders' => 'required',
             'grandTotal' => 'required'
         ]);

         $emails = [$request->email,'[email protected]'];

         Mail::to($emails)->send(new SendOrderEmail($data));

         return response()->json(['success' => true,'data' => 'Order Placed Successfully']);
     }

I don't know what is wrong in my code.

Sep
07
5 months ago
Activity icon

Started a new Conversation Handle Method Is Not Triggering In Laravel Queue

Hi

While running php artisan queue:work the handle method is not working in jobs. I am using QUEUE_CONNECTION=database . I don't know why the handle method is not working. I tried all the commands.

php artisan queue:work
php artisan queue:listen

php artisan config:cache 

controller

public function store(Request $request)
    {
         $this->validate($request,[
            'description' => 'required'
        ]);

        $communication =  Communication::create([
            'member_type' => $request->membertype_text,
            'description' => $request->description
        ]);

        $emails = Member::where('member_type',$request->member_type)->get(['email']);

        dispatch(new CommunicationJob($communication,$emails));

        return redirect('communications')->with('success','Email Send Successfully');

    }

jobs handle method

public function handle()
    {
       //return redirect('/');
        Mail::to($this->emails)->send(new CommunicationMail($this->communication));
    }

Please help me

thank you