laravel-4

Convert Latitude and Longitude into kms

谁都会走 提交于 2019-12-13 05:13:34
问题 I am building application where i am getting the user's latitude and longitude using the below code <!DOCTYPE html> <html> <body> <p>Click the button to get your coordinates.</p> <button onclick="getLocation()">Try It</button> <p id="demo"></p> <script> var x = document.getElementById("demo"); function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML = "Geolocation is not supported by this browser."; } } function

Laravel - artisan command not working

£可爱£侵袭症+ 提交于 2019-12-13 05:12:31
问题 I am getting started with using laravel on Mac and am using MAMP. I am using the `artisan' command with laravel in php. php artisan migrate:make create_users_table --table=users --create But it is giving me this error php artisan migrate:make create_users_table --table=users --create PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so, 9): image not found in

Laravel Many-to-Many Relation

こ雲淡風輕ζ 提交于 2019-12-13 05:07:20
问题 I have a many-to-many relationship to establish that is not returning results, although there is relevant data. What am I missing? MySQL Schema: entities - id services - id entity_service - entity_id - service_id Related Models: class Entity extends Eloquent implements UserInterface, RemindableInterface { // ... public function services() { return $this->belongsToMany('Service'); } } class Service extends Eloquent { // ... public function entities() { return $this->belongsToMany('Entity'); }

laravel using twitter bootstrap and datepicker

不想你离开。 提交于 2019-12-13 05:04:11
问题 I am trying to render a datepicker in the form created by laravel tags. So far, nothing else is showing except a regular text field. I've used this for the datepicker. And I did the below in the form: <p>{{ Form::text('dob', '', array('class' => 'form-control','placeholder' => 'تاريخ الميلاد', 'data-datepicker' => 'datepicker')) }}</p> Nonetheless, I am only getting this: What is the recommendation here? I also added the css and js to the header so all should be in place. Thanks, Update:

Artisan uncaught exception 'ReflectionException'

人盡茶涼 提交于 2019-12-13 05:02:11
问题 I am running Ubuntu64 vagrant/virtualbox with devbox from https://github.com/Aboalarm/devbox This box has worked with other development environments for this particular software. The application uses angularjs and laravel4. When installed on the box, I can get composer updated with: composer update --no-scripts but without that flag, I get a PHP fatal error. This is my composer.json: { "require": { "laravel/framework": "dev-master", "cartalyst/sentry": "2.1.*", "phpunit/phpunit": "3.7.*",

If I'm already using PDO then what is the advantage to further abstracting SELECT queries into Laravel's Eloquent ORM?

爱⌒轻易说出口 提交于 2019-12-13 04:51:20
问题 Consider the following READ and WRITE queries: Read // Retrieves a person (and their active game score if they have one) $sql = "SELECT CONCAT(people.first_name,' ',people.last_name) as 'name', people.uniform as 'people.uniform', games.score as 'games.score' FROM my_people as people LEFT JOIN my_games as games ON(games.person_id = people.id AND games.active = 1) WHERE people.id = :id"; $results = DB::select(DB::raw($sql),array("id"=>$id)); Write // Saves a person $person = new People; $person

How to make a route filters base on user type in Laravel 4?

六月ゝ 毕业季﹏ 提交于 2019-12-13 04:45:20
问题 Goal : I want to make route filter in Laravel 4 using Route::group and Route::filter Description I have 2 types of user : Internal Distributor For, Internal , I have 2 groups: admin regular For Distributor , I have 4 groups: gold silver bronze oem Eligible Route OEM Distributor are eligible for only 5 routes. Route::get('distributors/{id}', array('before' =>'profile', 'uses'=>'DistributorController@show')); Route::get('distributors/{id}/edit', 'DistributorController@edit'); Route::put(

How to reroute a resource to include a different field besides $id in Laravel 4

放肆的年华 提交于 2019-12-13 04:39:29
问题 I have a resource controlling one of my tables "fans". I have a view that shows the information for each respective. The urls for these right now is "url.com/fans/{$id}", where {$id} is the unique id for the row/object in the table. I would like to maintain this relationship, but I would also like to the url be pointed to another column in the table (another unique identifier). So something like "ulr.com/fans/{$new_column}". How would I reroute this view/url so that it appears like that? This

Textarea and input text is editable when using HTML2PDF plugin

假如想象 提交于 2019-12-13 04:38:49
问题 I am using HTL2PDF plugin . My problem is the Texarea and PDF is all editable in PDF that I recieve My code is as follow require_once(app_path().'/libs/html2pdf/html2pdf.class.php'); $html2pdf = new HTML2PDF('P','A4','en'); $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->WriteHTML($html22); $htmltosend=$html2pdf->Output('','S'); is there a way I can stop it from converting into editable PDF 回答1: If I understand you correctly, you want to create the PDF, but it should not be editable?

Paginate / Search Laravel issue

半世苍凉 提交于 2019-12-13 04:37:18
问题 After a couple of conversations on here i'm finally getting somewhere but after the pagintion now works when i got to search?page=2 i get a json array of the logged in user and not page 2 of the results. Here's my controller: public function search() { $q = Input::get('term'); if($q && $q != ''){ $searchTerms = explode(' ', $q); $query = DB::table('wc_program'); if(!empty($searchTerms)){ foreach($searchTerms as $term) { $query->where('JobRef', 'LIKE', '%'. $term .'%'); $query->orwhere('Road',