van-india

van-india

Laravel Developer at Byte and Bits At Ahmedabad

Member Since 1 Year Ago

bhavnagar

Experience Points
35,760
Total
Experience

4,240 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
143
Lessons
Completed
Best Reply Awards
14
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 8
35,760 XP
Jan
18
1 day ago
Activity icon

Replied to Specific Record Count Issue

@nakov perfect its working thank you sir

Activity icon

Replied to Argument 1 Passed To Illuminate\Database\Connection::prepareBindings() Must Be Of The Type Array, Null Given

@dalymhy

try this , sign not accept

public function search(Request $request)
{ 
        $search = $request->get('search'); 
        $image = DB::select(produits.id,produits.name,categories.name,produits.description,produits.volume,produits.poids,users.name,users.numtel) 
->from(produits) ->from(users) ->from(categories) ->where(produits.category_id = categories.id) 
->where(users.id = produits.user_id) 
->where(produits.description = [$search])->get();

        return view('home',['produits'=>$image]);
}
Activity icon

Started a new Conversation Specific Record Count Issue

i have records which value is diffrent for example i have 3 values single_bed/double_bed/two_bed when i have entry for single_bed 2 times then count single_bed = 2 same other double_bed 4 times enter then double_bed = 4

then i try in my code total count display so how to conditionwise count and display it

@foreach($bed as $list)
    @if($list->bed == "single_bed")
            <span>{{$list->count()}}</span>
            <span>Single Bed</span>
    @elseif($list->bed == "double_bed")    
        <span>{{$list->count()}}</span>
            <span class="">Double Bed</span>                                         
    @else
        <span>{{$list->count()}}</span>
            <span class="">Two Bed</span>
    @endif
@endforeach

how to fix it

Activity icon

Started a new Conversation Count() Not Working

hii i m stuck in count()

here is my code

@foreach($bed as $list)
    @if($list->bed == "single_bed")
        {{$list->bed->count()}}
    @else
    @endif
@endforeach

error like Call to a member function count() on string

Jan
17
2 days ago
Activity icon

Replied to Update Record Using Modal Popup

@jlrdw i didnt not understand

Activity icon

Started a new Conversation Update Record Using Modal Popup

hii i stuck in update record using modal popup

blade file

@foreach($data as $list)
    <a href="#" data-toggle="modal" data-target="#kt_modal_updateowner">Edit</a>
@endforeach

modal here
<div class="modal fade" id="kt_modal_updateowner">
    <form method="POST" action="{{route('ownerupdate_store',$view->user_id)}}">
        {{csrf_field()}}  
        <input type="text" name="owner" value="{{$updateowner->owner}}"> 
        <input type="text" name="email" value="{{$updateowner->email}}">  
        <button type="submit>           
    </form>
</div>

here is controller

public function updateowner_store(Request $request,$id)
    {
        $pg = Pg::where('user_id',$id)->first();
        \DB::table('owners')
                ->where('pg_id',$pg->id)
                ->update([
                'owner'=>$request->get('owner'),
                'email'=>$request->get('email'),          
            ]);
        return \Redirect::route('profile',['id'=>$pg->id]);
    }

public function profile($id)
    {
        $view = Pg::where('user_id','=',$id)->first();
        $updateowner = Owner::where('pg_id',$view->id)->first();    
        return view('admin.pages.pg.viewprofile',compact('view','updateowner'));
    }

when i update i record then everytime first record in display in popup modal so how can i do in click to particular data update using popup

Jan
10
1 week ago
Activity icon

Started a new Conversation Dependent Textbox Value City-state-country

simillar dropdown like select country then display state and city,

But change in my module like i have 3 textboxs like city/state/country, when i was enter country then other textbox display state and city so how can i do it i dont know how to implement using textbox so please help me..

thank you

Activity icon

Replied to Php Artisan Migrate Not Working

@sinnbeck its amazing working for me thank you actaully i try to sudo apt-get install php7.0-mysql

i did not notice my php version is 7.3 so thank you sir @sinnbeck

Activity icon

Replied to Php Artisan Migrate Not Working

@sinnbeck ok i added but when i try to install PDO error like -> sudo phpenmod pdo_mysql

WARNING: Module pdo_mysql ini file doesn't exist under /etc/php/7.3/mods-available WARNING: Module pdo_mysql ini file doesn't exist under /etc/php/7.3/mods-available

Activity icon

Started a new Conversation Php Artisan Migrate Not Working

i install unbutu 18.04 when i try to php artisan migrate then error like

Illuminate\Database\QueryException  : could not find driver (SQL: select * from information_schema.tables where table_schema = pg_management and table_name = migrations)

at      /opt/lampp/htdocs/pg_final/pgmanagment/vendor/laravel/framework/src/Illuminate/Database/Connection.ph   p:665
    661|         // If an exception occurs when attempting to run a query, we'll format the error
    662|         // message to include the bindings with SQL, which will make this exception a
    663|         // lot more helpful to the developer instead of just the database's errors.
    664|         catch (Exception $e) {
> 665|             throw new QueryException(
    666|                 $query, $this->prepareBindings($bindings), $e
    667|             );
    668|         }
669| 

Exception trace:

1 PDOException::("could not find driver") /opt/lampp/htdocs/pg_final/pgmanagment/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=pg_management", "root", "", []) /opt/lampp/htdocs/pg_final/pgmanagment/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

Please use the argument -v to see more details.

i also change in php.ini file

extension=php_pdo_mysql.dll add extension=pdo_mysql.so

after restart apache

but same error please help me out

Jan
01
2 weeks ago
Dec
28
3 weeks ago
Activity icon

Awarded Best Reply on How To Dowload File From Laravel Blade

@mushood @snapey thank you sir i understand my mistake and solved by myself

actually mistake was i use , sign

$myfile = public_path('PG/doc/',$file->id,'/',$file->multiple_doc);

now

$myfile = public_path('PG/doc/'.$file->id.'/'.$file->multiple_doc);

run perfectally thanks

Activity icon

Replied to How To Dowload File From Laravel Blade

@mushood @snapey thank you sir i understand my mistake and solved by myself

actually mistake was i use , sign

$myfile = public_path('PG/doc/',$file->id,'/',$file->multiple_doc);

now

$myfile = public_path('PG/doc/'.$file->id.'/'.$file->multiple_doc);

run perfectally thanks

Activity icon

Replied to How To Display File As Image View

@snapey yes sir sorry not duplicate question its by mistake i paste the error sorry sir

Activity icon

Replied to How To Dowload File From Laravel Blade

@snapey ok sir i check but my path was correct no any file missing

"/opt/lampp/htdocs/pg_final/pgmanagment/public/PG/doc/"     

my controller file may be my code was right or any line missing

public function downloadfile($id)
    {
        $file = Multipledocument::where('doc_id',$id)->first();
        // return $file;
        $myfile = public_path('PG/doc/',$file->id,'/',$file->multiple_doc);
        dd($myfile);
        return response()->download($myfile);
    }

here is my blade file

<a href="{{route('downloadfile',$docs->id)}}">            
        <img src="{{asset('admin/assets/media/users/doc.png')}}" height="100px" width="100px">
</a>
Activity icon

Replied to How To Dowload File From Laravel Blade

@snapey so how can i download correct path file

Activity icon

Replied to How To Dowload File From Laravel Blade

@mushood ok i check file path is valid so how can my mistake

"/opt/lampp/htdocs/pg_final/pgmanagment/public/PG/doc/"
Activity icon

Replied to How To Dowload File From Laravel Blade

sorry my past question by mistake i paste

@mushood ok i change but when i click same issue Failed - Server problem like error file not found

public function downloadfile($id)
    {
        $file = Multipledocument::where('doc_id',$id)->first();
        // return $file;
        $myfile = public_path('PG/doc/',$file->id,'/',$file->multiple_doc);
        return response()->download($myfile);
    }

blade file

<a href="{{route('downloadfile',$docs->pg_id)}}" download="">            
        <img src="{{asset('admin/assets/media/users/doc.png')}}" height="100px" width="100px">
    </a>
Activity icon

Replied to How To Display File As Image View

@mushood ok i change but when i click same issue Failed - Server problem like error

public function downloadfile($id)
    {
        $file = Multipledocument::where('doc_id',$id)->first();
        // return $file;
        $myfile = public_path('PG/doc/',$file->id,'/',$file->multiple_doc);
        return response()->download($myfile);
    }

blade file

<a href="{{route('downloadfile',$docs->pg_id)}}" download="">            
        <img src="{{asset('admin/assets/media/users/doc.png')}}" height="100px" width="100px">
    </a>
Activity icon

Started a new Conversation How To Dowload File From Laravel Blade

i try to download particular file to download but when i click to download then whole data as file download not file download so how to download file as particular idwise

here is my blade file

@foreach($doc as $docs)
    <a href="#" download="{{$docs->multiple_doc}}">            
                <img src="{{asset('admin/assets/media/users/doc.png')}}" height="100px" width="100px">
        </a>
@endforeach

try to download then output like below

/home/byteandbits/Downloads/{_id__1,_doc_id__1,multiple_doc___usRHurolYBS5iNVnNSmuIhHsd5Y4kg.png,created_at___2019-12-28 04_19_43,updated_at___2019-12-28 04_19_43}

Dec
27
3 weeks ago
Activity icon

Started a new Conversation How To Display File As Image View

hello guys i have table which store files so i want display that file as image like

i store pdf then display pdf viewer image or pdf symbol so how can i do this

here is my controller

public function multiple_doc(DocumentRequest $request,$id)
    {
        $doc = new Document(array(
                'pg_id'=>$request->get('pg_id'),
                'doc_name'=>$request->get('doc_name'),
        ));
        $doc->save();
        $doc_id = $doc->id;

        $file=Input::file('multiple_doc');
        foreach($file as $files)
        {
                $picName = str_random(30).'.'.$files->getClientOriginalExtension(); //Insert path in database
                $files->move(base_path().'PG/doc/'.$id.'/',$picName);       //Insert image in folder
                $doc = new Multipledocument(array(
                'doc_id'=>$doc_id,
                'multiple_doc'=>$picName,
            ));
            $doc->save();
        }
        return \Redirect::route('owner',['id'=>$id]);
    }

here is my blade file

@foreach($doc as $docs)
        <img src="{{URL::asset('PG/doc/'.$docs->pg_id.'/'.$docs->multiple_doc)}}" height="100px" width="100px">
@endforeach
Dec
26
3 weeks ago
Activity icon

Replied to Undefined Offset: 8

@nakov but its my forien key so

$table->integer('user_id')->unsigned();
    $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');

so how to do it

like i run this but same error

$table->integer('user_id')->unsigned();
    $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->nullable();
Activity icon

Replied to Undefined Offset: 8

@nakov sorry sir

but i listen then error like not null

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_id' cannot be null (SQL: insert into pgs (user_id, unique_id, name, email, contact_no, address, status, updated_at, created_at) values (, demo, 1231231231, active, , , , 2019-12-26 12:45:56, 2019-12-26 12:45:56))

return new Pg([
        'user_id'=> optional(User::find($row[1]))->id,
        'unique_id' => $row[2],
        'name' => $row[4],
        'email'=> $row[6],
        'contact_no'=> $row[8] ?? '',
        'address'=> $row[10] ?? '',
        'status'=> $row[18] ?? '',
    ]);
Activity icon

Replied to Undefined Offset: 8

@nakov ok i change but after same error Undefined offset: 8

'user_id'=> optional(User::find($row[1]))->id,  

this line error 'contact_no'=> $row[8],

Activity icon

Replied to Undefined Offset: 8

@nakov

i use forign key so when i import data into pg table at that time link with user table so how to fix it user_id errpr so

Activity icon

Replied to Undefined Offset: 8

@nakov

ok but my model index has already field

protected $fillable = [ 'user_id','unique_id','name','email','contact_no','address','status'];
Activity icon

Replied to Undefined Offset: 8

@nakov yes i try this but same line error Undefined index: contact_no

'contact_no'=> $row['contact_no'],
Activity icon

Started a new Conversation Undefined Offset: 8

i try to import excel file but when i try to import then error "Undefined offset: 8"

i use maatwebsite package for import excel sheet

here is my pgexport file

public function model(array $row)
    {
        return new Pg([
                'user_id' => $row[1],
                'unique_id' => $row[2],
                'name' => $row[4],
                'email'=> $row[6],
                'contact_no'=> $row[8],
                'address'=> $row[10],
                'status'=> $row[18],
        ]);
    }

thanks

Dec
23
3 weeks ago
Activity icon

Started a new Conversation Custom Column Visible

i used keenthemes.com but when i try to column visible or not then nothing option so how to setup custom column visible or not using dropdown

Activity icon

Replied to Download File From External Url

@ao try this

$filename = 'file.zip';
$tempfile = tempname(sys_get_temp_dir(), $filename);
copy('https://url.com/file.zip', $tempfile);

return response()->download($tempfile, $filename);
Dec
20
4 weeks ago
Activity icon

Replied to Multi Select Checkbox In Datatable

no sir @himanshurajvanshi actually i have jquery datatable

so i want to display checkboxes for multi select purpose so how can i add checkboxes with multi select in datatable

Activity icon

Replied to Multi Select Checkbox In Datatable

@fredmarks show checkboxes and multi select checkbox option in my datatable i search from google and apply but checkbox cant show how to do it?

Activity icon

Started a new Conversation Multi Select Checkbox In Datatable

how to add multi select checkbox in my datatable

Thank you

Dec
19
1 month ago
Activity icon

Replied to How To Display File In Laravel

@abdulbazith

but already store file and my question how to show file in image view like pdf store then display pdf

so how can i show i check data perfect return but image not show

Activity icon

Started a new Conversation How To Display File In Laravel

how can i show my laravel file using laravel blade

path->myproject->PG->doc->id->file

here is my code when so like image but nothing image display but data return correct but nothing show image

@foreach($doc as $docs)
        <img src="{{asset('PG/doc/'.$docs->user_id.'/'.$docs->multipledoc->multiple_doc)}}" height="50px" width="50px">
    @endforeach

data display correct but not showing how to show i think my asset was not right

Activity icon

Replied to Trying To Get Property 'multiple_doc' Of Non-object

i solved

change in document model

public function multipledoc()
    {
        return $this->belongsTo('App\Multipledocument','user_id');
    }

change in multiple document

public function docs()
    {
        return $this->hasMany('App\Document');
    }
Activity icon

Replied to Trying To Get Property 'multiple_doc' Of Non-object

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'multipledocuments.document_id' in 'where clause' (SQL: select * from multipledocuments where multipledocuments.document_id in (4))

Activity icon

Started a new Conversation Trying To Get Property 'multiple_doc' Of Non-object

i try to display child table record but when i display then error like

Trying to get property 'multiple_doc' of non-object

here is my blade file

<img src="{{asset('/PG/doc/'.$view->user_id.'/'.$doc->multipledocs->multiple_doc)}}" alt="image">

here is my controller file

public function profile($id)
    {
        $view = Pg::where('user_id','=',$id)->first();
        $doc = Document::where('user_id','=',$id)->first();
        return view('viewprofile',compact('view','doc'));
    }

here is my document model

protected $fillable = [
        'user_id','doc_type', 'doc_name', 'doc_number'
];

    public function docs()
    {
        return $this->hasMany('App\Multipledocument');
    }

here is my multipledocument modal

protected $fillable = [
        'doc_id','multiple_doc'
    ];

public function multipledocs()
    {
        return $this->belongsTo('App\Document','doc_id');
    }

here document is my parent table and multipledocument my child table so how can i display thank you

Dec
18
1 month ago
Activity icon

Replied to How To Check Multiple Array Elements Using In_array()

@sujancse but this is not right way

for example

@if(in_array('userprofile', explode(',', $users->enable_feature)))    
        ...............
@elseif(array_intersect(['payment','complains'],explode(',',$users->enable_feature)))
    ................
@elseif(array_intersect(['payment','userprofile','complains'],explode(',',$users->enable_feature)))
        .................
@else
        ...............
@endif 

so now how can i do it?

Activity icon

Replied to How To Check Multiple Array Elements Using In_array()

@sujancse

when i check using array_intersect always return if condition

like my value "userprofile" then return if condition

@if(array_intersect(['payment','userprofile','complains'],explode(',',$users->enable_feature)))    
        ...............
@elseif(array_intersect('userprofile', explode(',', $users->enable_feature)))
        .................
@else
        ...............
@endif

how to check particular value wise condition

Activity icon

Started a new Conversation How To Check Multiple Array Elements Using In_array()

hii guys

i try to check my multiple array value check if condition but doesnt work

here is my code

@if(in_array(['payment','userprofile','complains'],explode(',',$users->enable_feature)))    
    ...............
@elseif(array_intersect('userprofile', explode(',', $users->enable_feature)))
    .................
#else
    ...............
@endif

here is my code single value perfect work but i try to multple value check then return else part how to do it any other function or may be this function

Activity icon

Replied to How To Check Comma Seprated Value In If Condition ?

@sinnbeck

today i check but nothing work this condition why this condition not work i do not nay changes just open and check but not working

Dec
17
1 month ago
Activity icon

Replied to Display Records From Row Wise To Column Wise In Blade File Laravel

@abdulbazith ok

for example try this

$users = DB::table('users')
        ->select('id','exam', 'class','student','subject','marks')
        ->groupBy('id')
        ->get();

or else

DB::table('table_name')->distinct()->get(['column_name']);

Eloquent:

MyModel::distinct()->get(['column_name']);
Activity icon

Replied to How To Check Comma Seprated Value In If Condition ?

@sinnbeck congratulation when i click best answer and your level reach 50 very very congratulate sir i m happy sir for you you reach many more level sir